{"id":21352390,"url":"https://github.com/makeitworkpress/wp-register","last_synced_at":"2025-07-12T21:30:49.452Z","repository":{"id":88581909,"uuid":"79219516","full_name":"makeitworkpress/wp-register","owner":"makeitworkpress","description":"Makes registering custom post types, taxonomies, sidebars, menus and widgets pretty easy.","archived":false,"fork":false,"pushed_at":"2023-10-26T12:35:29.000Z","size":31,"stargazers_count":20,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T00:27:36.555Z","etag":null,"topics":["wordpress","wordpress-development","wordpress-library","wordpress-php-library","wordpress-plugin-development","wordpress-post-type","wordpress-theme-development"],"latest_commit_sha":null,"homepage":"https://makeitwork.press/scripts/wp-register/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makeitworkpress.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-17T11:09:16.000Z","updated_at":"2024-12-26T10:49:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"2edd4a50-e6bd-413e-9117-13a5bdb50b68","html_url":"https://github.com/makeitworkpress/wp-register","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/makeitworkpress/wp-register","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeitworkpress%2Fwp-register","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeitworkpress%2Fwp-register/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeitworkpress%2Fwp-register/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeitworkpress%2Fwp-register/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makeitworkpress","download_url":"https://codeload.github.com/makeitworkpress/wp-register/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makeitworkpress%2Fwp-register/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265059208,"owners_count":23705195,"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":["wordpress","wordpress-development","wordpress-library","wordpress-php-library","wordpress-plugin-development","wordpress-post-type","wordpress-theme-development"],"created_at":"2024-11-22T03:13:32.049Z","updated_at":"2025-07-12T21:30:49.210Z","avatar_url":"https://github.com/makeitworkpress.png","language":"PHP","readme":"# wp-register\r\nWordPress has many registration tasks. WP Register makes registering custom blocks, image sizes, menus, post types, taxonomies, sidebars and widgets easy. \r\n\r\nWP Register is maintained by [Make it WorkPress](https://makeitwork.press/scripts/wp-register/).\r\n\r\n## Usage\r\nInclude the WP_Register class in your plugin, theme or child theme file. Require it in your file, use an autoloader or include it using composer. You can read more about autoloading in [the readme of wp-autoload](https://github.com/makeitworkpress/wp-autoload).\r\n\r\n### Build your array with registrations\r\nYou can add the types you want to register through an multidimensional array, as explained in the example below\r\n\r\n```php\r\n$registrations = [\r\n    'blocks' =\u003e [\r\n        [\r\n            'type'  =\u003e 'custom/block-type',                     // The type, object or json path for the custom gutenberg block\r\n            'args'  =\u003e ['style' =\u003e 'custom-block-type-style']   // The arguments for registering a block, following the arguments in the codex\r\n        ]\r\n    ]\r\n    'image_sizes' =\u003e [\r\n        [\r\n            'name'   =\u003e 'fhd',\r\n            'height' =\u003e 1080,\r\n            'width'  =\u003e 1920,\r\n            'crop'   =\u003e true\r\n        ]\r\n    ],\r\n    'menus' =\u003e [\r\n        'menu-location'     =\u003e __('Custom Menu Location', 'textdomain'),\r\n        'another-location'  =\u003e __('AnotherCustom Menu Location', 'textdomain')\r\n    ],     \r\n    'post_types' =\u003e [\r\n        [\r\n            'name'          =\u003e 'beer', \r\n            'plural'        =\u003e __('Beers', 'textdomain'), \r\n            'singular'      =\u003e __('Beer', 'textdomain'), \r\n            'args'          =\u003e ['public' =\u003e true]       // Contains the arguments as they are supported by register_post_type. (optional)\r\n            'taxonomies'    =\u003e ['category']             // Connects existing taxonomies to this post type. Should be an array. (optional)\r\n            'slug'          =\u003e 'slug'                   // Sets a custom slug, fastforward for the rewrite slug setting in arguments\r\n            'icon'          =\u003e 'dashicon-beer'          // Sets a custom wp-admin menu icon, fastforward for the menu_icon setting in arguments\r\n        ]\r\n    ],\r\n    'sidebars' =\u003e [\r\n        [\r\n            'id'            =\u003e 'custom-sidebar', \r\n            'name'          =\u003e __('Custom Sidebar', 'textdomain'), \r\n            'description'   =\u003e __('Description for this sidebar', 'textdomain'),\r\n            'before_widget' =\u003e '\u003csection id=\"%1$s\" class=\"widget %2$s\"\u003e', // The opening element for the widget (optional)\r\n            'after_widget'  =\u003e '\u003c/section\u003e',  // The closing element for the widget (optional)\r\n            'before_title'  =\u003e '\u003ch3 class=\"widget-title\"\u003e',  // The opening title tag for the widget (optional)\r\n            'after_title'   =\u003e '\u003c/h3\u003e' // The closing title tag for the widget (optional)\r\n        ]\r\n    ],    \r\n    'taxonomies' =\u003e [\r\n        [\r\n            'name'      =\u003e 'type', \r\n            'object'    =\u003e 'beer', \r\n            'plural'    =\u003e __('Types', 'textdomain'), \r\n            'singular'  =\u003e __('Type', 'textdomain'),\r\n            'args'      =\u003e ['hierarchical' =\u003e true] // Contains the arguments as they are supported by register_post_type. (optional)\r\n       ]\r\n    ],\r\n    'widgets' =\u003e [\r\n        'WidgetClass' // The name of your custom widget class, namespeced if using autoload\r\n    ],\r\n];\r\n```\r\n    \r\n### Create instance\r\nCreate a new instance of the WP_Register class with your registration array and textdomain string as arguments in the following manner.\r\n\r\n```php\r\n$register = new MakeitWorkPress\\WP_Register\\Register( $registrations, 'textdomain' );\r\n```\r\n\r\nThe Register class accepts two arguments, namely an ``Array $registrations`` and ``String $textdomain``.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeitworkpress%2Fwp-register","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakeitworkpress%2Fwp-register","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakeitworkpress%2Fwp-register/lists"}