### Install Composer Dependencies for WP Framework Source: https://github.com/10up/wp-framework/blob/develop/CONTRIBUTING.md This command installs all necessary project dependencies using Composer. It should be run after cloning the repository to set up the development environment for the WP Framework. ```bash composer install ``` -------------------------------- ### Install WP Framework via Composer Source: https://github.com/10up/wp-framework/blob/develop/README.md This command installs the WP Framework package into your project using Composer, a dependency manager for PHP. It adds the framework as a required dependency, making its classes and functionalities available for use. ```bash composer require 10up/wp-framework ``` -------------------------------- ### Registering Custom Taxonomy with WP Framework in PHP Source: https://github.com/10up/wp-framework/wiki/Taxonomies This PHP example demonstrates how to register a custom taxonomy using the `AbstractTaxonomy` class from WP Framework. It defines the taxonomy's name, singular and plural labels, and associates it with a specific custom post type. This approach promotes modularity and simplifies taxonomy management within a WordPress plugin. ```php namespace TenUpPlugin\Taxonomies; use TenupFramework\Taxonomies\AbstractTaxonomy; class Demo extends AbstractTaxonomy { public function get_name() { return 'tenup-demo-category'; } public function get_singular_label() { return esc_html__( 'Category', 'tenup-plugin' ); } public function get_plural_label() { return esc_html__( 'Categories', 'tenup-plugin' ); } public function get_post_types() { return [ 'tenup-demo' ]; } } ``` -------------------------------- ### Extend Core Post Type using AbstractCorePostType in PHP Source: https://github.com/10up/wp-framework/blob/develop/README.md This PHP example demonstrates how to extend a WordPress core post type (like 'post') using `AbstractCorePostType` from the WP Framework. It allows for custom logic or modifications to existing core post types, such as defining supported taxonomies or running code after registration. ```php namespace TenUpPlugin\Posts; use TenupFramework\PostTypes\AbstractCorePostType; class Post extends AbstractCorePostType { public function get_name() { return 'post'; } public function get_supported_taxonomies() { return []; } public function after_register() { // Do nothing. } } ``` -------------------------------- ### Initialize Asset Variables with GetAssetInfo Trait in PHP Source: https://github.com/10up/wp-framework/wiki/Asset-Loading Demonstrates how to initialize asset variables within a PHP class by calling the `setup_asset_vars` method of the `GetAssetInfo` trait. This sets the base path for assets and defines a fallback version for cases where the corresponding `.asset.php` file is unavailable. ```php $this->setup_asset_vars( dist_path: TENUP_PLUGIN_PATH . 'dist/', fallback_version: TENUP_PLUGIN_VERSION ); ``` -------------------------------- ### Git Workflow and Release Commands for WP Framework Source: https://github.com/10up/wp-framework/blob/develop/CONTRIBUTING.md This section details the Git commands and workflow for managing branches and releases in the WP Framework project. It covers the branching strategy, merging procedures, pushing to remotes, and verifying changes before a new release. ```APIDOC Git Branching Strategy: - develop: The primary development branch, containing the next version to be released. - trunk: The stable branch, containing the latest released version. - release/X.Y.Z: A temporary branch cut from `develop` for preparing a specific release. Git Workflow: - Always work on the `develop` branch for new features and bug fixes. - Open Pull Requests (PRs) against the `develop` branch. Release Commands: 1. Create Release Branch: git checkout develop git checkout -b release/X.Y.Z 2. Merge Release Branch to develop (non-fast-forward): git checkout develop git merge --no-ff release/X.Y.Z 3. Merge develop into trunk (non-fast-forward, ensuring latest develop): git checkout develop git pull origin develop git checkout trunk git merge --no-ff develop 4. Push trunk to GitHub: git push origin trunk 5. Compare branches (for verification): https://github.com/10up/wp-framework/compare/trunk...develop ``` -------------------------------- ### Enqueue WordPress Script Using GetAssetInfo Trait in PHP Source: https://github.com/10up/wp-framework/wiki/Asset-Loading Illustrates how to enqueue a WordPress script (`wp_enqueue_script`) by dynamically retrieving its dependencies and version information using the `get_asset_info()` method from the `GetAssetInfo` trait. This ensures proper dependency loading and cache busting based on the `.asset.php` file. ```php wp_enqueue_script( 'tenup_plugin_admin', TENUP_PLUGIN_URL . 'dist/js/admin.js', $this->get_asset_info( 'admin', 'dependencies' ), $this->get_asset_info( 'admin', 'version' ), true ); ``` -------------------------------- ### Implementing a Custom Module in WP Framework (PHP) Source: https://github.com/10up/wp-framework/wiki/Autoloading This PHP code snippet illustrates the standard way to define a custom module within the WP Framework. It demonstrates how to implement the `TenupFramework\ModuleInterface` and use the `TenupFramework\Module` trait, providing a basic structure with `can_register` and `register` methods for module lifecycle management. ```php namespace YourNamespace; use TenupFramework\ModuleInterface; use TenupFramework\Module; class YourModule implements ModuleInterface { use Module; public function can_register(): bool { return true; } public function register(): void { // Register hooks and filters here. } } ``` -------------------------------- ### Implement ModuleInterface for Autoloading in PHP Source: https://github.com/10up/wp-framework/blob/develop/README.md This PHP code demonstrates how to implement the `ModuleInterface` for custom modules within the WP Framework, leveraging PSR-4 autoloading. It shows a basic module structure with `can_register()` and `register()` methods, using the `Module` trait for default implementation. ```php namespace YourNamespace; use TenupFramework\ModuleInterface; use TenupFramework\Module; class YourModule implements ModuleInterface { use Module; public function can_register(): bool { return true; } public function register(): void { // Register hooks and filters here. } } ``` -------------------------------- ### Define Custom Post Type with WP Framework (PHP) Source: https://github.com/10up/wp-framework/wiki/Post-Types This PHP snippet demonstrates how to create a custom post type by extending `TenupFramework\PostTypes\AbstractPostType`. It defines the post type's name, singular and plural labels, and menu icon, providing a structured way to register new content types in WordPress. ```php namespace TenUpPlugin\Posts; use TenupFramework\PostTypes\AbstractPostType; class Demo extends AbstractPostType { public function get_name() { return 'tenup-demo'; } public function get_singular_label() { return esc_html__( 'Demo', 'tenup-plugin' ); } public function get_plural_label() { return esc_html__( 'Demos', 'tenup-plugin' ); } public function get_menu_icon() { return 'dashicons-chart-pie'; } } ``` -------------------------------- ### Define Custom Post Type using AbstractPostType in PHP Source: https://github.com/10up/wp-framework/blob/develop/README.md This PHP snippet illustrates how to create a custom post type by extending `AbstractPostType` from the WP Framework. It defines methods to specify the post type's name, singular and plural labels, and menu icon, simplifying custom post type registration in WordPress. ```php namespace TenUpPlugin\Posts; use TenupFramework\PostTypes\AbstractPostType; class Demo extends AbstractPostType { public function get_name() { return 'tenup-demo'; } public function get_singular_label() { return esc_html__( 'Demo', 'tenup-plugin' ); } public function get_plural_label() { return esc_html__( 'Demos', 'tenup-plugin' ); } public function get_menu_icon() { return 'dashicons-chart-pie'; } } ``` -------------------------------- ### Define Custom Taxonomy using AbstractTaxonomy in PHP Source: https://github.com/10up/wp-framework/blob/develop/README.md This PHP snippet shows how to create a custom taxonomy by extending `AbstractTaxonomy` from the WP Framework. It defines the taxonomy's name, singular and plural labels, and specifies which post types it should be associated with, streamlining taxonomy registration in WordPress. ```php namespace TenUpPlugin\Taxonomies; use TenupFramework\Taxonomies\AbstractTaxonomy; class Demo extends AbstractTaxonomy { public function get_name() { return 'tenup-demo-category'; } public function get_singular_label() { return esc_html__( 'Category', 'tenup-plugin' ); } public function get_plural_label() { return esc_html__( 'Categories', 'tenup-plugin' ); } public function get_post_types() { return [ 'tenup-demo' ]; } } ``` -------------------------------- ### Modify Core Post Type with WP Framework (PHP) Source: https://github.com/10up/wp-framework/wiki/Post-Types This PHP snippet illustrates how to extend or modify a core WordPress post type (like 'post') by extending `TenupFramework\PostTypes\AbstractCorePostType`. It shows how to override the post type name and define supported taxonomies, allowing for customization of built-in WordPress functionalities. ```php namespace TenUpPlugin\Posts; use TenupFramework\PostTypes\AbstractCorePostType; class Post extends AbstractCorePostType { public function get_name() { return 'post'; } public function get_supported_taxonomies() { return []; } public function after_register() { // No additional functionality. } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.