1. Go to this page and download the library: Download pressgang-wp/quartermaster library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pressgang-wp / quartermaster example snippets
Quartermaster::posts()->toArgs(); // []
Quartermaster::posts('event');
// is equivalent to
Quartermaster::posts()->postType('event');
use PressGang\Quartermaster\Quartermaster;
$terms = Quartermaster::terms('category')
->hideEmpty()
->orderBy('name')
->limit(20)
->get();
// Terms attached to a specific post
$tags = Quartermaster::terms('post_tag')
->objectIds($post->ID)
->get();
// Leaf categories only (no children), return IDs
$leafIds = Quartermaster::terms('category')
->childless()
->fields('ids')
->get();
// Find terms by slug
$terms = Quartermaster::terms('genre')
->slug(['rock', 'jazz'])
->hideEmpty(false)
->get();
// All descendants of a parent term
$children = Quartermaster::terms('category')
->childOf(5)
->excludeTree(12)
->get();
// Get Timber term objects (runtime-guarded)
$timberTerms = Quartermaster::terms('category')
->hideEmpty()
->orderBy('name')
->timber();