Functions & constants
The theme option and page-meta getters, template tags, and constants safe to call from your own code.
Highend's public functions live mostly in functions/*.php (loaded directly by functions.php) and are wrapped in if ( ! function_exists( '...' ) ), so a child theme can fully redeclare any of them. This page covers the functions and constants you're most likely to call from a child theme or a custom template, not the theme's full internal API.
Reading theme options
Every setting from the Highend Options panel goes through one function:
highend_option( string $name, mixed $default = '' ): mixedProp
Type
Returns the saved value for that option, or $default if it isn't set. Internally it reads from the options-framework's storage (vp_option()) and runs the result through the highend_options_value filter.
if ( highend_option( 'hb_responsive' ) ) {
// Responsive mode is enabled.
}
$width = highend_option( 'hb_content_width', '1140px' );Option IDs aren't shown in the Highend Options UI. The most reliable way to find one is to search the theme's PHP for the setting's label text (its __() string), or check the relevant Theme Options doc page, which lists each setting's id.
Reading page and post meta
Per-page settings (the metaboxes shown when editing a post, page, portfolio item, and so on) are read with vp_metabox(), using dot notation to reach into a specific metabox group and field:
vp_metabox( string $key, mixed $default = null, int|null $post_id = null ): mixedProp
Type
$subtitle = vp_metabox( 'general_settings.hb_page_subtitle' );
$sidebar = vp_metabox( 'layout_settings.hb_page_layout_sidebar', 'default', $post_id );highend_get_post_meta( $key, $default = null, $post_id = null ) (in functions/common.php) is a thin wrapper around vp_metabox() that resolves $post_id for you with highend_get_the_id() when you don't pass one. It's useful outside The Loop (on is_home()/is_front_page(), where get_the_ID() alone won't return the right page).
Checking if a module is enabled
highend_is_module_enabled( string $module ): boolReturns whether a Highend Module (Portfolio, Gallery, Team Members, Testimonials, FAQ, Clients, Pricing Tables, and so on) is enabled. $module is the module's option ID, e.g. hb_module_portfolio.
Each module's own toggle only takes effect once you turn on the master Enable/Disable Highend Modules switch (hb_control_modules, off by default) in Highend OptionsModules. With that switch off (the default), highend_is_module_enabled() returns true for every module regardless of its individual toggle's stored value.
Several of the theme's own post type registrations are conditional on this. See Post types & taxonomies.
if ( highend_is_module_enabled( 'hb_module_portfolio' ) ) {
// The `portfolio` post type is registered.
}Breadcrumbs
hbthemes_breadcrumbs(): voidOutputs the breadcrumb trail. Delegates to Yoast SEO's, SEOPress's, or Rank Math's breadcrumb function first if one of those plugins is active (Yoast additionally requires its breadcrumbs setting to be enabled), otherwise renders Highend's own trail. Call it directly in a template override:
<?php hbthemes_breadcrumbs(); ?>Post likes
hb_like_this( int $post_id, string $action = 'get' ): int|voidProp
Type
Reads or increments a post's like count, stored in the _likes post meta key. hb_print_likes( $post_id ) and hb_print_portfolio_likes( $post_id ) (both in functions/theme-likes.php) build the ready-to-echo like button HTML around it.
$likes = hb_like_this( get_the_ID() ); // int, current count
echo hb_print_likes( get_the_ID() ); // full <div class="like-holder">ā¦</div> markupOther template tags
Prop
Type
Photo feeds
Added in 4.5.1. The Flickr and Pinterest widgets use this to read a network's public RSS feed on the server, cached by WordPress for 12 hours. No API keys are involved.
highend_get_photo_stream( string $network, string $username, int $limit = 6 ): arrayProp
Type
Returns a list of photos, each an array with url (link to the photo), image (thumbnail URL) and title, or an empty array if the feed can't be read.
foreach ( highend_get_photo_stream( 'flickr', 'flickr', 4 ) as $photo ) {
printf(
'<a href="%s"><img src="%s" alt="%s"></a>',
esc_url( $photo['url'] ),
esc_url( $photo['image'] ),
esc_attr( $photo['title'] )
);
}Loading Google Maps in JavaScript
Added in 4.5.1. highendGoogleLoad() (defined in assets/js/map.js, the highend-google-map script) loads the Google Maps JavaScript API once and runs your callback when it's ready. If the API is already on the page, the callback runs immediately.
highendGoogleLoad('maps', '3', {
other_params: 'key=YOUR_API_KEY',
callback: function () {
new google.maps.Map(document.getElementById('my-map'), { center: { lat: 40.71, lng: -74 }, zoom: 12 });
},
});Enqueue highend-google-map (wp_enqueue_script( 'highend-google-map' )) on pages where you call it. The theme's saved key is available from highend_option( 'hb_gmap_api_key' ).
highendGoogleLoad() only exists when Map Provider is Google Maps. With OpenStreetMap, the same highend-google-map handle loads assets/js/map-osm.js instead, which draws maps with MapLibre GL JS. Check the provider in PHP with highend_map_provider(), which returns 'google' or 'openstreetmap'.
To wait until an element is near the viewport before loading anything, use highendWhenVisible( elements, callback ), available with either provider. It's what Highend's own maps use.
Constants
Defined once in functions.php, available anywhere after the theme loads (see Overview for how they're set):
| Constant | Value |
|---|---|
HIGHEND_VERSION / HB_THEME_VERSION | The running theme version, e.g. "4.5.0". |
HIGHEND_THEME_PATH | Parent theme's filesystem path. |
HIGHEND_THEME_URI | Parent theme's URL. |
HBTHEMES_ROOT | Same as HIGHEND_THEME_PATH (get_template_directory()). |
HBTHEMES_URI | Same as HIGHEND_THEME_URI (get_template_directory_uri()). |
HBTHEMES_INCLUDES | HBTHEMES_ROOT . '/includes' |
HBTHEMES_ADMIN | HBTHEMES_ROOT . '/admin' |
HBTHEMES_ADMIN_URI | HBTHEMES_URI . '/admin' |
HBTHEMES_FUNCTIONS | HBTHEMES_ROOT . '/functions' |
// Check the running theme version before relying on a newer function.
if ( version_compare( HIGHEND_VERSION, '4.3.0', '>=' ) ) {
// ...
}All of the path/URI constants above resolve to the parent theme's folder, even when a child theme is active. Use get_stylesheet_directory() / get_stylesheet_directory_uri() for your own child theme's files.