{"id":46840629,"url":"https://github.com/itsmejgrant/custom-post-type-helper","last_synced_at":"2026-03-10T12:40:47.550Z","repository":{"id":46537344,"uuid":"469939646","full_name":"itsmejgrant/custom-post-type-helper","owner":"itsmejgrant","description":"A tiny helper package to hide away most of the config for creating Custom Post Types in WordPress","archived":false,"fork":false,"pushed_at":"2022-08-16T02:32:53.000Z","size":11,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T15:27:56.668Z","etag":null,"topics":["custompostypes","helper","php","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/itsmejgrant.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":"2022-03-14T23:38:09.000Z","updated_at":"2022-07-19T03:49:05.000Z","dependencies_parsed_at":"2022-09-07T05:31:02.741Z","dependency_job_id":null,"html_url":"https://github.com/itsmejgrant/custom-post-type-helper","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/itsmejgrant/custom-post-type-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmejgrant%2Fcustom-post-type-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmejgrant%2Fcustom-post-type-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmejgrant%2Fcustom-post-type-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmejgrant%2Fcustom-post-type-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsmejgrant","download_url":"https://codeload.github.com/itsmejgrant/custom-post-type-helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsmejgrant%2Fcustom-post-type-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30333869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["custompostypes","helper","php","wordpress"],"created_at":"2026-03-10T12:40:47.251Z","updated_at":"2026-03-10T12:40:47.527Z","avatar_url":"https://github.com/itsmejgrant.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Post Type Helper\n\nA super simple abstraction to make creating a Custom Post Types in WordPress a *breeze.*\n\n## Installation\n\nYou can either a) install with composer or b) copy the main the file and require it your functions file.\n\n### Composer\n\nIn your terminal, in the directory where your composer.json is (usually the theme directory):\n\n`composer require itsmejgrant/custom-post-type-helper`\n\nThen, in your `function.php` file: \n\n`use Itsmejgrant\\CustomPostTypeHelper\\CustomPostType`\n\nThat's it, you're ready to go!\n\n### Manual installation\n\nCopy the contents of the `CustomPostType.php` file and put it whereever makes sense in your theme directory.\n\nRequire it whereever you will be using it with:\n\n`require 'path/to/your/file.php';`\n\n## Usage\n\nTo use the helper, assign a new instance to a variable and manipulate as required. The only required argument is the name of the post type, however it's recommended to also pass a second argument to display a custom menu icon.\n\nExample:\n\n```php\nfunction my_custom_function() {\n  // Includes optional menu icon argument\n  $books = new CustomPostType('Books', 'dashicons-book');\n}\nadd_action('init', 'my_custom_function');\n```\n\nBy default, labels are based of the name passed as the first argument. You can override any of them using the `set_labels()` method. For example, we could the singular name if it doesn't make sense. The default for this is the name argument without the 's'.\n\n```php\nfunction my_custom_function() {\n  $people = new CustomPostType('People');\n  $people-\u003eset_labels([\n    'singular_name' =\u003e 'Person'\n  ]);\n}\nadd_action('init', 'my_custom_function');\n```\n\nThe `set_labels()` method an array of labels for this post type. Please see [here for a list of supported labels](https://developer.wordpress.org/reference/functions/get_post_type_labels/)\n\nSimilarly, the `set_args()` method allows us to override the default arguments. \n\n```php\nfunction my_custom_function() {\n  $sandwiches = new CustomPostType('Sandwich');\n  $sandwiches-\u003eset_args([\n    'menu_icon' =\u003e 'dashicon_sandwich'\n  ]);\n}\nadd_action('init', 'my_custom_function');\n```\n\n[See here for a list of supported arguments](https://developer.wordpress.org/reference/functions/register_post_type/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsmejgrant%2Fcustom-post-type-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsmejgrant%2Fcustom-post-type-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsmejgrant%2Fcustom-post-type-helper/lists"}