3, 'members_friends_layout' => 3, 'groups_layout' => 3, 'members_group_layout' => 3, 'group_front_page' => 0, 'group_front_boxes' => 0, 'user_front_page' => 0, 'user_nav_display' => 1, 'group_nav_display' => 1, ); update_option( 'bp_nouveau_appearance', $bp_nouveau_appearance ); update_option( $option_key, 1 ); } $defaults_configured = true; } /** * Clean up unused assets * * Removes styles and scripts for inactive plugins to reduce memory usage * and prevent unnecessary HTTP requests. * * @since 2.0.0 * @return void */ function buddyx_cleanup_unused_assets() { // Remove WooCommerce assets if plugin is not active if ( ! class_exists( 'WooCommerce' ) ) { wp_dequeue_style( 'buddyx-woocommerce' ); wp_deregister_style( 'buddyx-woocommerce' ); } // Remove BuddyPress assets if plugin is not active if ( ! function_exists( 'buddypress' ) && ! class_exists( 'BuddyPress' ) ) { wp_dequeue_style( 'buddyx-buddypress' ); wp_deregister_style( 'buddyx-buddypress' ); } } /** * Add conditional theme support * * Adds theme support features only for active plugins to avoid * unnecessary functionality loading. * * @since 2.0.0 * @return void */ function buddyx_add_conditional_theme_support() { // WooCommerce theme support if ( class_exists( 'WooCommerce' ) ) { add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } // BuddyPress theme support if ( function_exists( 'buddypress' ) || class_exists( 'BuddyPress' ) ) { add_theme_support( 'buddypress-use-nouveau' ); } } /** * Apply WooCommerce optimizations * * Removes default WooCommerce elements that are replaced by theme * implementations to avoid conflicts and duplication. * * @since 2.0.0 * @return void */ function buddyx_woocommerce_optimizations() { if ( class_exists( 'WooCommerce' ) ) { // Remove default WooCommerce breadcrumbs (theme provides its own) remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } } /** * Display BuddyPress legacy template notice * * Shows admin notice if BuddyPress is active but not using the required * Nouveau template pack. * * @since 2.0.0 * @return void */ function buddyx_buddypress_legacy_notice() { if ( ! is_admin() ) { return; } if ( function_exists( 'buddypress' ) && function_exists( 'bp_get_theme_compat_id' ) && 'nouveau' !== bp_get_theme_compat_id() ) { ?>

', '' ); ?>

queried_object_id != 0 && $bp_pages['register'] == $wp_query->queried_object_id ) { $bp_is_directory = false; } /* Activate page id and BuddyBoss saved activate page equal then bp_is_directory set false */ if ( isset( $bp_pages['activate'] ) && $bp_pages['activate'] != '' && get_the_ID() != 0 && $bp_pages['activate'] == get_the_ID() ) { $bp_is_directory = false; } /* Activate page id and buddypress saved activate page equal then bp_is_directory set false */ if ( isset( $bp_pages['activate'] ) && $bp_pages['activate'] != '' && $wp_query->queried_object_id != 0 && $bp_pages['activate'] == $wp_query->queried_object_id ) { $bp_is_directory = false; } return $bp_is_directory; } // ============================================================================= // THEME INITIALIZATION // ============================================================================= // Check system compatibility before proceeding if ( ! buddyx_compatibility_check() ) { // Load backward compatibility file for unsupported environments $back_compat_file = get_template_directory() . '/inc/back-compat.php'; if ( file_exists( $back_compat_file ) ) { require_once $back_compat_file; } return; } // Register autoloader buddyx_register_autoloader(); // Load external dependencies buddyx_load_external_dependencies(); // Hook theme initialization into WordPress add_action( 'after_setup_theme', 'buddyx_initialize', 1 ); add_action( 'after_setup_theme', 'buddyx_add_conditional_theme_support', 15 ); if ( class_exists( 'BuddyPress' ) ) { add_filter( 'bp_nouveau_theme_compat_page_templates_directory_only', 'buddyx_page_templates_directory_only' ); add_action( 'init', 'buddyx_setup_theme_defaults', 5 ); } add_action( 'init', 'buddyx_woocommerce_optimizations' ); add_action( 'wp_enqueue_scripts', 'buddyx_cleanup_unused_assets', 999 ); add_action( 'admin_notices', 'buddyx_buddypress_legacy_notice' );