Helpers
Overview
This page covers the remaining reusable helpers shipped in MAC Core outside of FormatDatetime.
Label Helpers
Post Type Labels
Global wrappers:
mac_get_post_type_label( ?string $post_type = null, string $type = 'singular', string $fallback = '' )mac_get_post_type_singular( ?string $post_type = null, string $fallback = '' )mac_get_post_type_plural( ?string $post_type = null, string $fallback = '' )
Use these when templates need the current post type label without hardcoding singular or plural copy.
Example:
<?php
echo mac_get_post_type_singular();
echo mac_get_post_type_plural( 'event' );
Taxonomy Labels
Global wrappers:
mac_get_taxonomy_label( string $taxonomy = 'category', string $type = 'singular', string $fallback = '' )mac_get_taxonomy_singular( int|string|\WP_Term|null $term_or_tax = 'category', string $fallback = '' )mac_get_taxonomy_plural( int|string|\WP_Term|null $term_or_tax = 'category', string $fallback = '' )
These helpers accept:
- a taxonomy slug
- a term ID
- a
WP_Term
Example:
<?php
echo mac_get_taxonomy_singular( 'category' );
echo mac_get_taxonomy_plural( get_queried_object() );
Post Terms Helpers
Global wrappers:
mac_get_post_terms()mac_get_post_terms_html()mac_get_post_terms_plain()
Supported output formats:
plainlinksspans
Example:
<?php
echo mac_get_post_terms_plain( get_the_ID(), 'category' );
echo mac_get_post_terms_html( get_the_ID(), 'event-category', 'term-list__item' );
Use the generic mac_get_post_terms() wrapper when you need to control format, attribute, CSS class, or separator explicitly.
Array Counting Helper
Global wrapper:
mac_count_array_items( string $meta_key, ?int $post_id = null )
This is useful for array-style post meta such as galleries or repeaters that are stored as arrays in post meta.
Example:
<?php
echo mac_count_array_items( 'gallery_images' );
echo mac_count_array_items( 'gallery_images', 123 );
Plugin Status Helpers
These helpers are class-based, not global wrappers.
Generic checker:
MacCore\Utils\GetPluginStatus::isPluginActive( 'plugin-dir/plugin-file.php' )
Examples of explicit helpers:
MacCore\Utils\GetPluginStatus::isAcfActive()MacCore\Utils\GetPluginStatus::isFramesActive()MacCore\Utils\GetPluginStatus::isPerfmattersActive()MacCore\Utils\GetPluginStatus::isRankMathActive()MacCore\Utils\GetPluginStatus::isSureCartActive()MacCore\Utils\GetPluginStatus::isWsFormActive()
Use these when shared code needs to branch based on the active plugin stack without repeating plugin-file checks.
Theme Status Helpers
These helpers are also class-based.
Generic checker:
MacCore\Utils\GetThemeStatus::isThemeActive( 'theme-slug' )
Explicit helpers:
MacCore\Utils\GetThemeStatus::isBricksThemeActive()MacCore\Utils\GetThemeStatus::isEtchThemeActive()
isThemeActive() checks both the active stylesheet and parent template, so it works for child-theme scenarios as well.
Usage Rule
Use the documented helper wrappers and static helper methods as the public utility surface.
Do not depend on:
- private helper methods
- internal caches
- implementation-only class properties