{"id":18273457,"url":"https://github.com/arraypress/cpt-inline-list-table","last_synced_at":"2025-07-05T02:04:38.818Z","repository":{"id":228268926,"uuid":"773537092","full_name":"arraypress/cpt-inline-list-table","owner":"arraypress","description":"Lightweight custom post type inline tables.","archived":false,"fork":false,"pushed_at":"2024-03-31T10:54:23.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T03:41:26.897Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/arraypress.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T23:08:30.000Z","updated_at":"2025-01-23T07:49:43.000Z","dependencies_parsed_at":"2024-03-18T00:23:37.119Z","dependency_job_id":"bb9ccd2a-4d06-41e9-9e93-77666f9a6ec8","html_url":"https://github.com/arraypress/cpt-inline-list-table","commit_stats":null,"previous_names":["arraypress/cpt-inline-list-table"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/arraypress/cpt-inline-list-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fcpt-inline-list-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fcpt-inline-list-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fcpt-inline-list-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fcpt-inline-list-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arraypress","download_url":"https://codeload.github.com/arraypress/cpt-inline-list-table/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arraypress%2Fcpt-inline-list-table/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263645558,"owners_count":23494005,"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":[],"created_at":"2024-11-05T12:06:32.372Z","updated_at":"2025-07-05T02:04:38.797Z","avatar_url":"https://github.com/arraypress.png","language":"PHP","readme":"# Custom Post Type Inline List Table for WordPress\n\nBy leveraging the Custom Post Type Inline List Table library, developers can easily register, display, and manage custom\npost types with enhanced functionalities such as custom columns, script and style enqueues, admin menu highlighting, and\nmore. Designed for seamless integration with WordPress core functionalities, this tool streamlines the administrative\ntasks associated with custom post types, offering a developer-friendly approach to customization and management.\n\n**Key Features:**\n\n- **Custom Column Management:** Define and manage custom columns for your post type's list table, providing a tailored\n  view of your data.\n- **Script and Style Enqueues:** Specify admin screens where custom scripts and styles should be loaded, enhancing the\n  admin UI and UX.\n- **Admin Menu Highlighting:** Maintain menu and submenu highlighting within the admin sidebar, improving navigation and\n  usability.\n- **Flexible Pagination:** Control the number of items displayed per page in the list table, supporting efficient data\n  handling and presentation.\n- **Streamlined Integration:** Utilize hooks and WordPress core functions for a smooth integration, adhering to\n  WordPress standards and best practices.\n\nThis library facilitates the creation of a refined administrative interface for custom post types, ensuring a coherent\nand efficient management experience within the WordPress admin.\n\n## Installation\n\nEnsure you have the package installed in your project. If not, you can typically include it using Composer:\n\n```php\ncomposer require arraypress/cpt-inline-list-table\n```\n\n### Example Usage\n\nThe `register_inline_table` function allows for easy setup and configuration of your custom post type's inline list\ntable. Here's how to use it:\n\n```php\n// Example usage of register_inline_table_post_type to create a 'Conditional Fee' custom post type.\nregister_inline_post_type(\n    'conditional_fee',                                  // The key for the custom post type.\n    __( 'Conditional Fee', 'edd-conditional-fees' ),    // The singular name of the custom post type for labels.\n    __( 'Conditional Fees', 'edd-conditional-fees' ),   // The plural name of the custom post type for labels.\n    'conditional_fee',                                  // The slug for the custom post type.\n    [ 'excerpt', 'custom-fields', 'editor' ],           // (Optional) Additional features the post type supports.\n    false                                               // (Optional) Whether to expose this post type in the WordPress REST API. Enables use of the Gutenberg editor and REST API queries.\n);\n\n/**\n * Defines columns for the list table of a custom post type, showcasing conditional discounts.\n * This configuration automatically includes default columns such as title, date, and author.\n * Additional custom columns can specify callbacks for rendering their content or use formatters\n * for specific data presentation. If only a key and label are provided (without a callback),\n * the system will first look for a matching property in the post object, then check post meta.\n *\n * When defining columns, it's crucial to understand the built-in logic for data retrieval:\n *\n * 1. If a 'callback' is provided, it will be used to fetch and render the column's data.\n * 2. Without a 'callback', the system searches for a matching property within the post object.\n * 3. If not found in the post object, the system then searches the post meta.\n * 4. A 'formatter' function can be used to format the value obtained from the callback or automatic data retrieval.\n *\n * This approach provides flexibility in displaying both standard and custom data within your list table.\n */\n\n$columns = [\n\t// Example of a custom column with a callback and formatter.\n\t'amount'          =\u003e [\n\t\t'label'     =\u003e __( 'Amount', 'edd-conditional-fees' ),\n\t\t'callback'  =\u003e function ( $post ) {\n\t\t\treturn get_post_meta( $post-\u003eID, 'amount', true );\n\t\t},\n\t\t'formatter' =\u003e function ( $value, $post ) {\n\t\t\treturn edd_currency_filter( edd_format_amount( $value ) );\n\t\t},\n\t],\n\t// Example of a simple column that relies on automatic data sourcing.\n\t'expiration_date' =\u003e [\n\t\t'label' =\u003e __( 'Expiration Date', 'edd-conditional-fees' ),\n\t\t// No callback needed; the system will automatically search for 'expiration_date' in post object or meta.\n\t]\n];\n\n// Registers an inline list table for a specified custom post type, configuring it with\n// custom columns, administrative URLs, and settings for menu highlighting.\nregister_inline_table(\n\t'conditional_fee', // The custom post type identifier.\n\t$columns, // Associative array of columns with render callbacks and formatters.\n\t'edd_conditional_fees_table', // Hook name to attach the list table initialization.\n\t10, // Priority for the hook to control when the list table is initialized.\n\t'edit.php?post_type=download\u0026page=edd-settings\u0026tab=extensions', // URL for admin redirects.\n\t[ 'download_page_edd-settings' ], // Admin screens where scripts/styles should be enqueued.\n\t'edit.php?post_type=download', // Parent file slug for menu highlighting.\n\t'edd-settings' // Submenu file slug for submenu highlighting.\n);\n\n// Registers a settings section for managing conditional fees within the extension settings.\nfunction register_section( array $sections ): array {\n\t$sections['conditional_fees'] = __( 'Conditional Fees', 'edd-conditional-fees' );\n\n\treturn $sections;\n}\n\nadd_filter( 'edd_settings_sections_extensions', __NAMESPACE__ . '\\\\register_section' );\n\n// Adds settings for the 'Conditional Fees' section within the extension settings, enabling the configuration of rules.\nfunction register_settings( array $existing_settings ): array {\n\treturn array_merge( $existing_settings, [\n\t\t'conditional_fees' =\u003e [\n\t\t\t[\n\t\t\t\t'id'   =\u003e 'conditional_fees_table',\n\t\t\t\t'name' =\u003e __( 'Conditional Fees', 'edd-conditional-fees' ),\n\t\t\t\t'type' =\u003e 'hook',\n\t\t\t],\n\t\t]\n\t] );\n}\n\nadd_filter( 'edd_settings_extensions', __NAMESPACE__ . '\\\\register_settings' );\n```\n\n## Contributions\n\nWe welcome contributions to enhance the library's functionality and compatibility. Feel free to submit pull requests or\nreport issues on our GitHub repository.\n\n## License\n\nThe Custom Post Type Inline List Table library is open-sourced software licensed under the GPL-2.0-or-later license. It\nis free for personal and commercial use, adhering to the terms of the GNU General Public License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farraypress%2Fcpt-inline-list-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farraypress%2Fcpt-inline-list-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farraypress%2Fcpt-inline-list-table/lists"}