Download the PHP package achttienvijftien/wp-primary-term without Composer
On this page you can find all versions of the php package achttienvijftien/wp-primary-term. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download achttienvijftien/wp-primary-term
More information about achttienvijftien/wp-primary-term
Files in achttienvijftien/wp-primary-term
Package wp-primary-term
Short Description Primary term selector for WP taxonomies
License proprietary
Homepage https://www.1815.nl
Informations about the package wp-primary-term
WP Primary Term
Primary term selector for WordPress taxonomies.
Installation (Development)
Install PHP dependencies:
Install JavaScript dependencies:
Lint
Format code:
Testing
The PHP test suite consists of WordPress integration tests (WP_UnitTestCase)
and runs inside the wp-env test environment.
Start the environment (first run pulls the Docker images):
Run the tests:
This runs PHPUnit inside the tests-cli container against the mounted plugin.
The WordPress test library is provided by wp-env (WP_TESTS_DIR); PHPUnit and
the PHPUnit Polyfills are installed as Composer dev dependencies, so make sure
composer install has been run first.
Building
Build for production:
Watch mode for development:
Usage
Enable Primary Term for Taxonomies
Use the achttienvijftien_primary_term_taxonomies filter to enable primary term functionality:
Global Functions
All functions take the taxonomy slug first; the post ID is optional and defaults to the current post.
Check whether a post has a primary term (bool):
Get the primary term ID (int, or WP_Error for an invalid taxonomy):
Get the primary term object (WP_Term, WP_Error, or null when none resolves):
When no primary term is stored, these fall back to the first assigned term. Disable
that fallback with the achttienvijftien_primary_term_use_fallback filter: