BuddyX

BuddyX Pro Functions Reference

Pro feature

Key public functions available in BuddyX Pro for theme and child-theme developers.

Every function listed here is defined in the shipped 5.1.4 code. File paths are exact. Function names that look misspelled (for example buddyx_login_reigister_popup) are reproduced verbatim because that is the real symbol you must call.


Overview

BuddyX Pro exposes helper functions for:

  • Template rendering (breadcrumbs, sub-header, comments, reading time)
  • Login / registration flows and BuddyPress integration
  • Dark / light color-mode handling
  • Plugin-integration containers (Dokan, WooCommerce, LearnDash, FluentCart)

Functions live in inc/extra.php, the inc/Helpers/* classes-of-functions, inc/class-buddyx-breadcrumbs.php, and the per-integration files under inc/compatibility/. Components (namespaced classes under inc/*/Component.php) are covered in Theme Architecture.


Core Theme Function

buddyxpro()

File: inc/functions.php

Main theme accessor. Returns the shared Template_Tags instance.

function buddyxpro(): BuddyxPro\BuddyxPro\Template_Tags;

Usage:

// Theme version
$version = buddyxpro()->get_version();

// Asset version (filemtime in debug, theme version in production)
$asset_version = buddyxpro()->get_asset_version( $filepath );

// Theme asset URL or inline content
$logo_url    = buddyxpro()->get_theme_asset( 'logo.svg', 'svg' );
$svg_content = buddyxpro()->get_theme_asset( 'icon.svg', 'svg', true );

Template Tag Methods

Accessible through buddyxpro()->method(). get_version(), get_asset_version(), and get_theme_asset() are direct methods on inc/Template_Tags.php. Sidebar / nav helpers such as display_left_sidebar(), is_right_sidebar_active(), display_primary_nav_menu(), is_amp(), the_comments(), print_styles(), and print_scripts() are registered template tags dispatched through the same object.

get_version()

buddyxpro()->get_version(): string;

get_asset_version()

buddyxpro()->get_asset_version( string $filepath ): string;

get_theme_asset()

buddyxpro()->get_theme_asset(
    string $filename,
    string $type = 'images',
    bool   $content = false
): ?string;
Name Type Description
$filename string Asset filename
$type string Asset subdirectory (images, svg, ...)
$content bool Return file content instead of URL
// Image URL
$logo = buddyxpro()->get_theme_asset( 'logo.webp', 'images' );

// Inline SVG content
$icon = buddyxpro()->get_theme_asset( 'icon.svg', 'svg', true );

Layout & Sub-Header Functions

buddyx_site_loader()

File: inc/extra.php

Output the site preloader HTML (rendered when the loader option is enabled).

function buddyx_site_loader(): void;

buddyx_sub_header()

File: inc/extra.php

Render the page sub-header (page-title area). Hooked to the buddyx_sub_header action by default.

function buddyx_sub_header(): void;

buddyx_maybe_render_sub_header()

File: inc/extra.php

Conditionally render the sub-header based on per-page and customizer settings.

function buddyx_maybe_render_sub_header(): void;

buddyx_is_sub_header_enabled()

File: inc/extra.php

Whether the sub-header is enabled for the current view.

function buddyx_is_sub_header_enabled(): bool;

Note: there is no buddyx_site_layout() or buddyx_sidebar_option() function. Read the layout and sidebar directly with get_theme_mod() (for example get_theme_mod( 'site_layout', 'wide' ), get_theme_mod( 'global_sidebar_option', 'right' )), or use the buddyxpro()->display_left_sidebar() / is_right_sidebar_active() template tags.


Login & Registration Functions

buddyx_login_reigister_popup()

File: inc/Helpers/Login_Forms.php

Output the login / register popup modal markup. (The spelling is intentional - this is the real function name.)

function buddyx_login_reigister_popup(): void;

buddyx_signin_form()

File: inc/Helpers/Login_Forms.php

AJAX handler for the sign-in form (username/email + password, remember me, redirect, error messages).

function buddyx_signin_form(): void;

buddyx_signup_form()

File: inc/Helpers/Login_Forms.php

AJAX handler for the registration form (validation, password confirmation, BuddyPress integration).

function buddyx_signup_form(): void;

buddyx_register_new_user()

File: inc/Helpers/Login_Forms.php

Register a new user with a password.

function buddyx_register_new_user( $user_login, $user_email, $user_pass );
Name Type Description
$user_login string Username
$user_email string Email address
$user_pass string Password

Returns: User ID (int) on success, WP_Error on failure.

buddyx_get_buddypress_fields()

File: inc/Helpers/Login_Forms.php

Get the xProfile fields configured for the registration form.

function buddyx_get_buddypress_fields(): array;

BuddyPress Functions

buddyx_buddypress_active()

File: inc/Helpers/Login_Forms.php

Check whether BuddyPress is active.

function buddyx_buddypress_active(): bool;
if ( buddyx_buddypress_active() ) {
    // BuddyPress-specific code
}

buddyx_BuddyPress() still exists as a deprecated backward-compatible alias of buddyx_buddypress_active(). Do not use it in new code.

buddyx_filter_activity_content()

File: inc/Helpers/Activity_Functions.php

Enhance activity-stream content (joined-group, friendship, avatar, and cover-image activities).

function buddyx_filter_activity_content(): void;

buddyx_user_profile_menu()

File: inc/extra.php

Output the user profile dropdown menu in the header.

function buddyx_user_profile_menu(): void;

buddyx_ajax_addremove_friend()

File: inc/extra.php

AJAX handler for add / remove friend actions. Registered on the wp_ajax_buddyx_ajax_addremove_friend action.

function buddyx_ajax_addremove_friend(): void;

Dark / Light Color-Mode Functions

buddyx_resolve_color_mode()

File: inc/Helpers/Dark_Mode.php

Resolve the active color mode (light, dark, or auto) for the current request.

function buddyx_resolve_color_mode(): string;

buddyx_save_dark_mode()

File: inc/Helpers/Dark_Mode.php

AJAX handler that persists the visitor's color-mode preference. Registered on wp_ajax_buddyx_save_dark_mode.

function buddyx_save_dark_mode(): void;

buddyx_color_mode_body_class()

File: inc/Helpers/Dark_Mode.php

Add the color-mode body class.

function buddyx_color_mode_body_class( array $classes ): array;

The color-mode toggle UI itself is rendered by the Color_Mode_Toggle component (inc/Color_Mode_Toggle/Component.php) on the buddyx_header_actions hook. There is no buddyx_mode_switch() or buddyx_is_dark_mode() function.


Comment Functions

buddyx_pro_post_comment_box()

File: inc/extra.php

Output the post comment form (with reactions).

function buddyx_pro_post_comment_box(): void;

buddyx_pro_comments_callback()

File: inc/extra.php

Custom comment-display callback for wp_list_comments().

function buddyx_pro_comments_callback( $comment, $args, $depth ): void;

Side Panel & Menu Functions

buddyx_panel_callback()

File: inc/Helpers/Side_Panel.php

Output the side-panel content.

function buddyx_panel_callback(): void;

buddyx_menu_icons_settings()

File: inc/Helpers/Side_Panel.php

Filter the Menu Icons plugin settings.

function buddyx_menu_icons_settings( $settings ): array;

buddyx_site_menu_icon()

File: inc/extra.php

Render the header menu-icon actions area (search, cart, and the buddyx_header_actions hook).

function buddyx_site_menu_icon(): void;

Reading Time Functions

buddyxpro_get_reading_time_minutes()

File: inc/extra.php

Estimate the reading time (in whole minutes) for a post.

function buddyxpro_get_reading_time_minutes( $post = null ): int;
Name Type Description
$post int|WP_Post|null Post to measure. Defaults to the current post.

The result is filterable via buddyxpro_reading_time_minutes.

buddyxpro_render_reading_time_meta()

File: inc/extra.php

Echo the reading-time meta markup for the current post.

function buddyxpro_render_reading_time_meta(): void;

Breadcrumb Functions

buddyx_get_breadcrumb()

File: inc/class-buddyx-breadcrumbs.php

Render (or return) the breadcrumb trail. Wrapper around the BuddyX_Breadcrumbs class.

function buddyx_get_breadcrumb( $echo = true );
Name Type Description
$echo bool Echo the trail (true, default) or return it as a string (false).

The default args are filterable via buddyx_breadcrumb_trail_args.

// Echo the breadcrumb
buddyx_get_breadcrumb();

// Capture it as a string
$crumbs = buddyx_get_breadcrumb( false );

buddyx_attr()

File: inc/class-buddyx-breadcrumbs.php

Build a contextual HTML attributes string (filtered through buddyx_attr_{$context}).

function buddyx_attr( $context, $attributes = array(), $args = array() ): string;

bbPress Functions

buddyx_bbp_get_reply_avtar()

File: inc/extra.php

Get reply-author avatars for a bbPress topic. (Spelling avtar is the real symbol.)

function buddyx_bbp_get_reply_avtar( $topic_id = 0 ): array;

Dokan Functions

File: inc/compatibility/dokan/dokan-functions.php (loaded only when Dokan is active)

buddyx_store_container_open()

Open the Dokan store-page container wrapper.

function buddyx_store_container_open(): void;

buddyx_store_container_close()

Close the Dokan store-page container wrapper.

function buddyx_store_container_close(): void;

LearnDash Functions

File: inc/compatibility/learndash/learndash-functions.php (loaded only when LearnDash is active)

buddyx_learndash_single_course_header()

Render the single-course header.

function buddyx_learndash_single_course_header(): void;

buddyx_learndash_instructor_header()

Render the instructor profile header.

function buddyx_learndash_instructor_header(): void;

buddyx_learndash_lms_get_course_participants()

AJAX handler that returns course participants. Registered on wp_ajax_buddyx_learndash_lms_get_course_participants.

function buddyx_learndash_lms_get_course_participants(): void;

Widget Classes

Widget files live in inc/widgets/ and are registered on widgets_init.

BP_BUDDYX_BP_Login_Widget

File: inc/widgets/login-widget.php

BuddyX login-form widget.

class BP_BUDDYX_BP_Login_Widget extends WP_Widget;

BP_BuddyxPro_Profile_Completion_Widget

File: inc/widgets/bp-profile-completion-widget.php

BuddyPress profile-completion widget.

class BP_BuddyxPro_Profile_Completion_Widget extends WP_Widget;

LD_Course_Features_Widget

File: inc/widgets/ld-featured-course-widget.php

LearnDash featured-course widget.

class LD_Course_Features_Widget extends WP_Widget;

BuddyxPro_WCV_Widget_Vendor_Profile

File: inc/widgets/class-vendor-profile-widget.php

WC Vendors store / vendor-profile widget (loaded only when a supported marketplace plugin is active).

class BuddyxPro_WCV_Widget_Vendor_Profile extends WC_Widget;

AJAX Actions

Action Handler Registered in
buddyx-signin-form buddyx_signin_form() inc/Helpers/Login_Forms.php
buddyx-signup-form buddyx_signup_form() inc/Helpers/Login_Forms.php
buddyx_save_dark_mode buddyx_save_dark_mode() inc/Helpers/Dark_Mode.php
buddyx_ajax_addremove_friend buddyx_ajax_addremove_friend() inc/extra.php
buddyx_theme_unread_notification buddyx_set_unread_notification() inc/compatibility/buddypress/buddypress-functions.php
buddyx_learndash_lms_get_course_participants buddyx_learndash_lms_get_course_participants() inc/compatibility/learndash/learndash-functions.php
buddyxpro_install_plugin Plugin_Installer\Component::ajax_install_plugin() inc/Plugin_Installer/Component.php
buddyx_lms_toggle_theme_color Accessibility\Component::toggle_theme_color() inc/Accessibility/Component.php

Example AJAX call:

The theme localizes the global front-end script (buddyxpro-custom) with a buddyx_data object that exposes ajax_url and the color-mode nonce:

jQuery.ajax( {
    url:  buddyx_data.ajax_url,
    type: 'POST',
    data: {
        action: 'buddyx_save_dark_mode',
        mode:   'dark',
        nonce:  buddyx_data.dark_mode_nonce
    },
    success: function ( response ) {
        console.log( response );
    }
} );

Reading Theme Options

BuddyX Pro stores its settings as standard theme mods. There is no buddyx_get_option() wrapper - read values with WordPress core get_theme_mod():

$layout  = get_theme_mod( 'site_layout', 'wide' );
$primary = get_theme_mod( 'site_primary_color', '#ee4036' );

Color and dimension theme mods are turned into --bx-color-* / --bx-radius-* CSS custom properties by the Tokens component - see the Customization Guide.


Constants

Constant Value Description
BUDDYXPRO_MINIMUM_WP_VERSION '6.5' Minimum WordPress version
BUDDYXPRO_MINIMUM_PHP_VERSION '8.0' Minimum PHP version

Both are defined in functions.php.


Related Documentation