{"id":20204415,"url":"https://github.com/underpin-wp/custom-post-type-loader","last_synced_at":"2025-04-10T12:12:35.191Z","repository":{"id":57075291,"uuid":"364017368","full_name":"Underpin-WP/custom-post-type-loader","owner":"Underpin-WP","description":"Loader for custom post types","archived":false,"fork":false,"pushed_at":"2021-11-24T21:33:05.000Z","size":17,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T11:07:09.450Z","etag":null,"topics":["custom-post-type","underpin","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-03T18:02:03.000Z","updated_at":"2023-07-20T10:50:38.000Z","dependencies_parsed_at":"2022-08-24T10:40:51.084Z","dependency_job_id":null,"html_url":"https://github.com/Underpin-WP/custom-post-type-loader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fcustom-post-type-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fcustom-post-type-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fcustom-post-type-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fcustom-post-type-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Underpin-WP","download_url":"https://codeload.github.com/Underpin-WP/custom-post-type-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217080,"owners_count":21066633,"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":["custom-post-type","underpin","wordpress"],"created_at":"2024-11-14T05:13:03.173Z","updated_at":"2025-04-10T12:12:35.174Z","avatar_url":"https://github.com/Underpin-WP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Underpin Custom Post Type Loader\n\nLoader That assists with adding custom Post Types to a WordPress website.\n\n## Installation\n\n### Using Composer\n\n`composer require underpin/custom-post-type-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-custom-post-type/custom-post-types.php');`\n\n## Setup\n\n1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)\n1. Register new custom post types menus as-needed.\n\n## Example\n\nA very basic example could look something like this.\n\n```php\n// Register custom Post Type\nunderpin()-\u003ecustom_post_types()-\u003eadd( 'example_type', [\n\t'type' =\u003e 'example-type', // see register_post_type\n\t'args' =\u003e [ /*...*/ ] // see register_post_type\n] );\n\n```\n\nAlternatively, you can extend `Custom_Post_Type` and reference the extended class directly, like so:\n\n```php\nunderpin()-\u003ecustom_post_types()-\u003eadd('custom-post-type-key','Namespace\\To\\Class');\n```\n\n## Querying\n\nA Custom Post Type instance includes a method, called `query`, which serves as a wrapper for `new WP_Query`.\n\nThis encapsulates queries for this post type in a method, and gives you a place to override exactly _how_ this post type\nis queried, should you decide to extend the class.\n\n```php\nunderpin()-\u003ecustom_post_types()-\u003eget( 'post_type' )-\u003equery();\n```\n\n## Editing Posts\n\nLike querying, Custom Post Type instances includes a method called `save` which serves as a wrapper for `wp_insert_post`\nand `wp_update_post`. It also includes notice-logging so you can track what happens on a request.\n\nThis encapsulates save actions for this post type in a set of methods, and gives you a place to override exactly _how_\nthis post type is saved, should you decide to extend the class.\n\n```php\nunderpin()-\u003ecustom_post_types()-\u003esave( [/* see wp_insert_post */] );\n```\n\n## Deleting Posts\n\nThis works in the same way as `save` and `query`. It includes logging, and provides a way to encapsulate the action.\n\n```php\nunderpin()-\u003ecustom_post_types()-\u003edelete( $id, $force_delete );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fcustom-post-type-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funderpin-wp%2Fcustom-post-type-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fcustom-post-type-loader/lists"}