BuddyX Pro Functions Reference
Key functions available in BuddyX Pro for developers.
Overview
BuddyX Pro provides utility functions for:
- Theme configuration
- Layout management
- BuddyPress integration
- WooCommerce customization
- Template helpers
Core Theme Functions
buddyxpro()
File: inc/functions.php
Main theme entry point. Returns the theme template tags instance.
function buddyxpro(): BuddyxPro\BuddyxPro\Template_Tags;
Usage:
// Get theme version
$version = buddyxpro()->get_version();
// Get asset version (filemtime in debug, theme version in production)
$asset_version = buddyxpro()->get_asset_version( $filepath );
// Get theme asset URL or content
$logo_url = buddyxpro()->get_theme_asset( 'logo.svg', 'svg' );
$svg_content = buddyxpro()->get_theme_asset( 'icon.svg', 'svg', true );
Layout Functions
buddyxsitelayout()
File: inc/extra.php
Get the current site layout setting.
function buddyx_site_layout(): string;
Returns: 'boxed' or 'wide'
Usage:
if ( buddyx_site_layout() === 'boxed' ) {
echo '';
}
buddyxsidebaroption()
File: inc/extra.php
Get sidebar position for current page.
function buddyx_sidebar_option(): string;
Returns: 'left', 'right', 'both', or 'none'
Usage:
$sidebar = buddyx_sidebar_option();
if ( $sidebar !== 'none' ) {
get_sidebar();
}
buddyxsiteloader()
File: inc/extra.php
Output the site loader/preloader HTML.
function buddyx_site_loader(): void;
Usage:
// Called automatically in header if enabled
buddyx_site_loader();
Login & Registration Functions
buddyxloginreigister_popup()
File: inc/extra.php
Output the login/register popup modal.
function buddyx_login_reigister_popup(): void;
buddyxsigninform()
File: inc/extra.php
Process the sign-in form AJAX submission.
function buddyx_signin_form(): void;
Handles:
- Username/email + password authentication
- Remember me
- Redirect URL
- Error messages
buddyxsignupform()
File: inc/extra.php
Process the registration form AJAX submission.
function buddyx_signup_form(): void;
Handles:
- User registration
- Email validation
- Password confirmation
- BuddyPress integration
buddyxregisternew_user()
File: inc/extra.php
Register a new user with password.
function buddyx_register_new_user(
string $user_login,
string $user_email,
string $user_pass
): int|WP_Error;
Parameters:
Name Type Description $user_loginstring Username $user_emailstring Email address $user_passstring Password
Returns: User ID on success, WP_Error on failure.
BuddyPress Functions
buddyx_BuddyPress()
File: inc/extra.php
Check if BuddyPress is active.
function buddyx_BuddyPress(): bool;
Usage:
if ( buddyx_BuddyPress() ) {
// BuddyPress-specific code
}
buddyxgetbuddypress_fields()
File: inc/extra.php
Get custom BuddyPress profile fields for registration.
function buddyx_get_buddypress_fields(): array;
Returns: Array of xProfile field IDs and data.
buddyxfilteractivity_content()
File: inc/extra.php
Filter and enhance activity stream content.
function buddyx_filter_activity_content(): void;
Adds enhanced activity content for:
- Joined group activities
- Friendship activities
- Avatar uploads
- Cover image uploads
buddyxuserprofile_menu()
File: inc/extra.php
Output the user profile dropdown menu in header.
function buddyx_user_profile_menu(): void;
buddyxajaxaddremove_friend()
File: inc/extra.php
AJAX handler for friend add/remove actions.
function buddyx_ajax_addremove_friend(): void;
Comment Functions
buddyxpropostcommentbox()
File: inc/extra.php
Output the post comment form with reactions.
function buddyx_pro_post_comment_box(): void;
buddyxprocomments_callback()
File: inc/extra.php
Custom comment display callback.
function buddyx_pro_comments_callback(
WP_Comment $comment,
array $args,
int $depth
): void;
Dark Mode Functions
buddyxmodeswitch()
File: inc/extra.php
Output the dark mode toggle switch.
function buddyx_mode_switch(): void;
buddyxsavedark_mode()
File: inc/extra.php
AJAX handler to save dark mode preference.
function buddyx_save_dark_mode(): void;
Panel & Menu Functions
buddyxpanelcallback()
File: inc/extra.php
Output the side panel content.
function buddyx_panel_callback(): void;
buddyxsidepanelmetabox()
File: inc/extra.php
Register the side panel sections meta box.
function buddyx_side_panel_meta_box(): void;
buddyxmenuicons_settings()
File: inc/extra.php
Configure menu icons plugin settings.
function buddyx_menu_icons_settings( array $settings ): array;
Breadcrumb Functions
buddyxbreadcrumbtrail()
File: inc/class-buddyx-breadcrumbs.php
Generate breadcrumb trail HTML.
function buddyx_breadcrumb_trail( array $args = array() ): string;
Parameters:
Name Type Description $argsarray Breadcrumb configuration
Arguments:
$args = array(
'container' => 'nav',
'before' => '',
'after' => '',
'browse_tag' => 'h2',
'list_tag' => 'ul',
'item_tag' => 'li',
'show_on_front' => true,
'network' => false,
'show_browse' => true,
'show_title' => true,
'labels' => array(),
'post_taxonomy' => array(),
);
Usage:
echo buddyx_breadcrumb_trail( array(
'show_browse' => false,
) );
buddyx_attr()
File: inc/class-buddyx-breadcrumbs.php
Build HTML attributes string.
function buddyx_attr(
string $context,
array $attributes = array(),
mixed $args = ''
): string;
bbPress Functions
buddyxbbpgetreplyavtar()
File: inc/extra.php
Get reply author avatar for bbPress topics.
function buddyx_bbp_get_reply_avtar( int $topic_id = 0 ): array;
Returns: Array of reply author avatars.
WooCommerce Functions
Located in inc/compatibility/woocommerce/woocommerce-functions.php:
buddyxwcproductsperpage()
Set products per page on shop.
function buddyx_wc_products_per_page(): int;
buddyxwcloop_columns()
Set product grid columns.
function buddyx_wc_loop_columns(): int;
buddyxwcrelatedproductsargs()
Configure related products display.
function buddyx_wc_related_products_args( array $args ): array;
LearnDash Functions
Located in inc/compatibility/learndash/learndash-functions.php:
buddyxlearndashsinglecourseheader()
Output Udemy-style course header.
function buddyx_learndash_single_course_header(): void;
buddyxlearndashinstructor_header()
Output instructor profile header.
function buddyx_learndash_instructor_header(): void;
buddyxlearndashlmsgetcourse_participants()
Get course participants/students.
function buddyx_learndash_lms_get_course_participants(
int $course_id,
int $num_students = 4
): array;
buddyxldcoursegridfilter()
Output course archive filters.
function buddyx_ld_course_grid_filter(): void;
Dokan Functions
Located in inc/compatibility/dokan/dokan-functions.php:
buddyxdokancontainer_start()
Output Dokan page container start.
function buddyx_dokan_container_start(): void;
buddyxdokancontainer_end()
Output Dokan page container end.
function buddyx_dokan_container_end(): void;
buddyxdokanvendorstoreheader()
Render vendor store header.
function buddyx_dokan_vendor_store_header(): void;
Template Tag Methods
Accessible via buddyxpro()->method():
get_version()
Get theme version.
buddyxpro()->get_version(): string;
getassetversion()
Get asset version (for cache busting).
buddyxpro()->get_asset_version( string $filepath ): string;
getthemeasset()
Get theme asset URL or content.
buddyxpro()->get_theme_asset(
string $filename,
string $type = 'images',
bool $content = false
): ?string;
Parameters:
Name Type Description $filenamestring Asset filename $typestring Asset type/subdirectory $contentbool Return content instead of URL
Examples:
// Get image URL
$logo = buddyxpro()->get_theme_asset( 'logo.webp', 'images' );
// Get SVG content for inline use
$icon = buddyxpro()->get_theme_asset( 'icon.svg', 'svg', true );
Helper Functions
buddyxgetoption()
Get theme option with default fallback.
function buddyx_get_option( string $key, mixed $default = '' ): mixed;
Usage:
$layout = buddyx_get_option( 'site_layout', 'wide' );
buddyxisdark_mode()
Check if dark mode is currently active.
function buddyx_is_dark_mode(): bool;
Widget Functions
BuddyXLoginWidget
Login widget class.
class BuddyX_Login_Widget extends WP_Widget {
public function widget( $args, $instance );
public function form( $instance );
public function update( $new_instance, $old_instance );
}
BuddyXBPProfileCompletionWidget
BuddyPress profile completion widget.
class BuddyX_BP_Profile_Completion_Widget extends WP_Widget;
BuddyxStarterLearnDashCourseWidget
LearnDash featured course widget.
class Buddyx_Starter_LearnDash_Course_Widget extends WP_Widget;
BuddyxStarterVendorProfileWidget
Vendor profile widget (Dokan/WC Vendors).
class Buddyx_Starter_Vendor_Profile_Widget extends WC_Widget;
AJAX Actions
Action Handler Function Purpose buddyx-signin-formbuddyxsigninform()User login buddyx-signup-formbuddyxsignupform()User registration buddyxsavedark_modebuddyxsavedark_mode()Save dark mode preference buddyxaddremovefriendbuddyxajaxaddremove_friend()Friend actions
Example AJAX call:
jQuery.ajax({
url: buddyxpro_ajax.ajaxurl,
type: 'POST',
data: {
action: 'buddyx_save_dark_mode',
mode: 'dark',
nonce: buddyxpro_ajax.nonce
},
success: function( response ) {
console.log( response );
}
});
Constants
Constant Value Description BUDDYXPROMINIMUMWP_VERSION‘5.4’ Minimum WordPress version BUDDYXPROMINIMUMPHP_VERSION‘8.0’ Minimum PHP version
Related Documentation
- Theme Structure – Architecture overview
- Hooks Reference – Actions and filters
- Customizer Options – Theme settings
