{"id":21611502,"url":"https://github.com/underpin-wp/widget-loader","last_synced_at":"2026-05-02T05:03:25.169Z","repository":{"id":49059390,"uuid":"364359145","full_name":"Underpin-WP/widget-loader","owner":"Underpin-WP","description":"Underpin loader for WordPress widgets","archived":false,"fork":false,"pushed_at":"2021-11-23T16:42:50.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T07:57:01.149Z","etag":null,"topics":["underpin","widget","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Underpin-WP.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-04T19:06:02.000Z","updated_at":"2021-11-23T16:42:53.000Z","dependencies_parsed_at":"2022-09-13T11:10:32.082Z","dependency_job_id":null,"html_url":"https://github.com/Underpin-WP/widget-loader","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Underpin-WP/widget-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fwidget-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fwidget-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fwidget-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fwidget-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Underpin-WP","download_url":"https://codeload.github.com/Underpin-WP/widget-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fwidget-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261883133,"owners_count":23224439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["underpin","widget","wordpress"],"created_at":"2024-11-24T21:12:55.607Z","updated_at":"2026-05-02T05:03:20.150Z","avatar_url":"https://github.com/Underpin-WP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Underpin Widget Loader\n\nLoader That assists with adding widgets to a WordPress website. It uses Underpin's built-in fields API to handle\nthe render, and storage of widget data\n\n## Installation\n\n### Using Composer\n\n`composer require underpin/widget-loader`\n\n### Manually\n\nThis plugin uses a built-in autoloader, so as long as it is required _before_\nUnderpin, it should work as-expected.\n\n`require_once(__DIR__ . '/underpin-widgets/index.php');`\n\n## Setup\n\n1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)\n1. Register new widgets menus as-needed.\n\n## Example\n\nA very basic example could look something like this.\n\n```php\n// Register widget\nunderpin()-\u003ewidgets()-\u003eadd( 'hello-world-widget', [\n\t'name'                =\u003e underpin()-\u003e__( 'Hello World Widget' ),                               // Required. The name of the widget.\n\t'id_base'             =\u003e 'widget_name',                                                        // Required. The ID.\n\t'description'         =\u003e underpin()-\u003e__( 'Displays hello to a specified name on your site.' ), // Widget description.\n\t'widget_options'      =\u003e [                                                                     // Options to pass to widget. See wp_register_sidebar_widget\n\t\t'classname' =\u003e 'test_widget',\n\t],\n\t'get_fields_callback' =\u003e function ( $fields, \\WP_Widget $widget ) {                            // Fetch, and set settings fields.\n\t\t$name = isset( $fields['name'] ) ? esc_html( $fields['name'] ) : 'world';\n\n\t\treturn [\n\t\t\tnew \\Underpin\\Factories\\Settings_Fields\\Text( $name, [\n\t\t\t\t'name'        =\u003e $widget-\u003eget_field_name( 'name' ), // See WP_Widget get_field_name\n\t\t\t\t'id'          =\u003e $widget-\u003eget_field_id( 'name' ),   // See WP_Widget get_field_id\n\t\t\t\t'setting_key' =\u003e 'name',                            // Must match field name and field ID\n\t\t\t\t'description' =\u003e underpin()-\u003e__( 'Optional. Specify the person to say hello to. Default \"world\".' ),\n\t\t\t\t'label'       =\u003e underpin()-\u003e__( 'Name' ),\n\t\t\t] ),\n\t\t];\n\t},\n\t'display_callback'    =\u003e function ( $instance, $fields ) {                                      // Render output\n\t\t$name = ! empty( $fields['name'] ) ? esc_html( $fields['name'] ) : 'world';\n\n\t\techo underpin()-\u003e__( sprintf( 'Hello, %s!', $name ) );\n\t},\n] );\n```\n\nAlternatively, you can extend `Widget` and reference the extended class directly, like so:\n\n```php\nunderpin()-\u003ewidgets()-\u003eadd('widget-key','Namespace\\To\\Class');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fwidget-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funderpin-wp%2Fwidget-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fwidget-loader/lists"}