', '

' ); } else { echo '
'; buddyx_get_breadcrumb(); echo '
'; } } } // Site Loader if ( ! function_exists( 'buddyx_site_loader' ) ) { function buddyx_site_loader() { $loader = get_theme_mod( 'site_loader', buddyx_defaults( 'site-loader' ) ); if ( $loader == '1' ) { echo '
'; } } } // Site Search and Woo icon if ( ! function_exists( 'buddyx_site_menu_icon' ) ) { function buddyx_site_menu_icon() { // menu icons $searchicon = (int) get_theme_mod( 'site_search', buddyx_defaults( 'site-search' ) ); $carticon = (int) get_theme_mod( 'site_cart', buddyx_defaults( 'site-cart' ) ); if ( ! empty( $searchicon ) || ! empty( $carticon ) ) : ?> activity->component ) { case 'xprofile': $mini_activity_actions = __( 'Profile', 'buddyx' ); break; case 'activity': $mini_activity_actions = __( 'Activity', 'buddyx' ); break; case 'groups': $mini_activity_actions = __( 'Groups', 'buddyx' ); break; case 'bbpress': $mini_activity_actions = __( 'Forums', 'buddyx' ); break; case 'friends': $mini_activity_actions = __( 'Friends', 'buddyx' ); break; case 'members': $mini_activity_actions = __( 'Members', 'buddyx' ); break; case 'blogs': $mini_activity_actions = __( 'Blogs', 'buddyx' ); break; default: $mini_activity_actions = __( 'Activity', 'buddyx' ); break; } return apply_filters( 'buddyx_bp_get_activity_css_first_class', $mini_activity_actions, $activities_template->activity->component ); } } /** * Is the current user online * * @param $user_id * * @return bool */ if ( ! function_exists( 'buddyx_is_user_online' ) ) { function buddyx_is_user_online( $user_id ) { if ( ! function_exists( 'bp_get_user_last_activity' ) ) { return; } $last_activity = strtotime( bp_get_user_last_activity( $user_id ) ); if ( empty( $last_activity ) ) { return false; } // the activity timeframe is 5 minutes $activity_timeframe = 5 * MINUTE_IN_SECONDS; return ( time() - $last_activity <= $activity_timeframe ); } } /** * BuddyPress user status * * @param $user_id */ if ( ! function_exists( 'buddyx_user_status' ) ) { function buddyx_user_status( $user_id ) { if ( buddyx_is_user_online( $user_id ) ) { echo ''; } } } /** * woocommerce_cart_collaterals */ remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); add_action( 'woocommerce_after_cart_form', 'woocommerce_cross_sell_display', 10 ); /* Ensure cart contents update when products are added to the cart via AJAX */ add_filter( 'woocommerce_add_to_cart_fragments', 'buddyx_header_add_to_cart_fragment' ); if ( ! function_exists( 'buddyx_header_add_to_cart_fragment' ) ) { function buddyx_header_add_to_cart_fragment( $fragments ) { $count = WC()->cart->get_cart_contents_count(); ob_start(); ?> $type, 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => $limit, 'offset' => $offset, 'post_status' => 'publish', 'post__not_in' => array_diff( $hidden, $earned_ids ), ); // Filter - query completed or non completed achievements if ( $filter == 'completed' ) { $args['post__in'] = array_merge( array( 0 ), $earned_ids ); } elseif ( $filter == 'not-completed' ) { $args['post__not_in'] = array_merge( $hidden, $earned_ids ); } if ( '' !== $meta_key && '' !== $meta_value ) { $args['meta_key'] = $meta_key; $args['meta_value'] = $meta_value; } // Include certain achievements if ( ! empty( $include ) ) { $args['post__not_in'] = array_diff( $args['post__not_in'], $include ); $args['post__in'] = array_merge( array( 0 ), array_diff( $include, $args['post__in'] ) ); } // Exclude certain achievements if ( ! empty( $exclude ) ) { $args['post__not_in'] = array_merge( $args['post__not_in'], $exclude ); } // Search if ( $search ) { $args['s'] = $search; } // Loop Achievements $achievement_posts = new WP_Query( $args ); $query_count += $achievement_posts->found_posts; while ( $achievement_posts->have_posts() ) : $achievement_posts->the_post(); // If we were given an ID, get the post if ( is_numeric( get_the_ID() ) ) { $achievement = get_post( get_the_ID() ); } $achievements .= '
'; $achievements .= '' . badgeos_get_achievement_post_thumbnail( $achievement->ID ) . ''; $achievements .= '
'; $achievement_count++; endwhile; wp_reset_query(); $post = $old_post; } echo '
'; echo '
' . _n( 'Recently earned badge', 'Recently earned badges', $achievement_count, 'buddyx' ) . '
'; echo '
' . $achievements . '
'; echo '
'; } } } /** * Function Footer Custom Text */ if ( ! function_exists( 'buddyx_footer_custom_text' ) ) { /** * Function Footer Custom Text * * @since 1.0.14 * @param string $option Custom text option name. * @return mixed Markup of custom text option. */ function buddyx_footer_custom_text() { $copyright = esc_html( get_theme_mod( 'site_copyright_text' ) ); $output = $copyright; if ( '' != $output ) { $output = str_replace( '[current_year]', date_i18n( 'Y' ), $output ); $output = str_replace( '[site_title]', '' . esc_html( get_bloginfo( 'name' ) ) . '', $output ); $theme_author = apply_filters( 'buddyx_theme_author', array( 'theme_name' => __( 'BuddyX WordPress Theme', 'buddyx' ), 'theme_author_url' => esc_url( 'https://wbcomdesigns.com/downloads/buddyx-theme/' ), ) ); $output = str_replace( '[theme_author]', '' . esc_html( $theme_author['theme_name'] ) . '', $output ); } return apply_filters( 'buddyx_footer_copyright_text', $output, $copyright ); } } /** * Categorized Blog * Find out if blog has more than one category. */ if ( ! function_exists( 'buddyx_categorized_blog' ) ) { function buddyx_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'buddyx_category_count' ) ) ) { $all_the_cool_cats = get_categories( array( 'hide_empty' => 1 ) ); $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'buddyx_category_count', $all_the_cool_cats ); } if ( 1 !== (int) $all_the_cool_cats ) { return true; } else { return false; } } } /** * Blog Post Meta */ if ( ! function_exists( 'buddyx_posted_on' ) ) { function buddyx_posted_on() { global $post; if ( is_sticky() && is_home() && ! is_paged() ) { echo '' . esc_html__( 'Sticky', 'buddyx' ) . ''; } if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && buddyx_categorized_blog() ) { echo '' . get_the_category_list( ', ' ) . ''; } if ( ! is_search() ) { if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'buddyx' ), esc_html__( '1 Comment', 'buddyx' ), esc_html__( '% Comments', 'buddyx' ) ); echo ''; } } edit_post_link( esc_html__( 'Edit', 'buddyx' ), '', '' ); } } /** * Managing Login and Register URL in Frontend */ if ( ! function_exists( 'buddyx_alter_login_url_at_frontend' ) ) { add_filter( 'login_url', 'buddyx_alter_login_url_at_frontend', 10, 3 ); function buddyx_alter_login_url_at_frontend( $login_url, $redirect, $force_reauth ) { if ( is_admin() ) { return $login_url; } $buddyx_login_page_id = get_theme_mod( 'buddyx_login_page', '0' ); if ( $buddyx_login_page_id ) { $buddyx_login_page_url = get_permalink( $buddyx_login_page_id ); if ( $buddyx_login_page_url ) { $login_url = $buddyx_login_page_url; } } return $login_url; } } if ( ! function_exists( 'buddyx_alter_register_url_at_frontend' ) ) { add_filter( 'register_url', 'buddyx_alter_register_url_at_frontend', 10, 1 ); function buddyx_alter_register_url_at_frontend( $register_url ) { if ( is_admin() ) { return $register_url; } $buddyx_registration_page_id = get_theme_mod( 'buddyx_registration_page', '0' ); if ( $buddyx_registration_page_id ) { $buddyx_registration_page_url = get_permalink( $buddyx_registration_page_id ); if ( $buddyx_registration_page_url ) { $register_url = $buddyx_registration_page_url; } } return $register_url; } } /** * Redirect to selected login page from options. */ if ( ! function_exists( 'buddyx_redirect_login_page' ) ) { function buddyx_redirect_login_page() { /* removing conflict with logout url */ if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'logout' ) ) { return; } global $wbtm_buddyx_settings; $login_page_id = $wbtm_buddyx_settings['buddyx_pages']['buddyx_login_page']; $register_page_id = $wbtm_buddyx_settings['buddyx_pages']['buddyx_register_page']; $login_page = get_permalink( $login_page_id ); $register_page = get_permalink( $register_page_id ); $page_viewed_url = basename( $_SERVER['REQUEST_URI'] ); $exploded_Url = wp_parse_url( $page_viewed_url ); if ( ! isset( $exploded_Url['path'] ) ) { return; } // For register page if ( $register_page && 'wp-login.php' == $exploded_Url['path'] && 'action=register' == $exploded_Url['query'] && $_SERVER['REQUEST_METHOD'] == 'GET' ) { wp_redirect( $register_page ); exit; } // For login page if ( $login_page && $exploded_Url['path'] == 'wp-login.php' && $_SERVER['REQUEST_METHOD'] == 'GET' ) { wp_redirect( $login_page ); exit; } } } /** * Add 404 page redirect */ if ( ! function_exists( 'buddyx_404_redirect' ) ) { function buddyx_404_redirect() { // media popup fix if ( strpos( $_SERVER['REQUEST_URI'], 'media' ) !== false ) { return; } // media upload fix if ( strpos( $_SERVER['REQUEST_URI'], 'upload' ) !== false ) { return; } if ( ! is_404() ) { return; } $buddyx_404_page_id = get_theme_mod( 'buddyx_404_page', '0' ); if ( $buddyx_404_page_id ) { $buddyx_404_page_url = get_permalink( $buddyx_404_page_id ); wp_redirect( $buddyx_404_page_url ); exit; } } add_action( 'template_redirect', 'buddyx_404_redirect' ); } /** * Add Elementor Locations Support */ if ( ! function_exists( 'buddyx_register_elementor_locations' ) ) { function buddyx_register_elementor_locations( $elementor_theme_manager ) { $elementor_theme_manager->register_location( 'header' ); $elementor_theme_manager->register_location( 'footer' ); } add_action( 'elementor/theme/register_locations', 'buddyx_register_elementor_locations' ); } /** * Display LifterLMS Course and Lesson sidebars * on courses and lessons in place of the sidebar returned by * this function * * @param string $id default sidebar id (an empty string) * @return string */ if ( ! function_exists( 'buddyx_llms_sidebar_function' ) ) { function buddyx_llms_sidebar_function( $id ) { $my_sidebar_id = 'sidebar-right'; // replace this with your theme's sidebar ID return $my_sidebar_id; } add_filter( 'llms_get_theme_default_sidebar', 'buddyx_llms_sidebar_function' ); } /** * Declare explicit theme support for LifterLMS course and lesson sidebars * * @return void */ if ( ! function_exists( 'buddyx_llms_theme_support' ) ) { function buddyx_llms_theme_support() { add_theme_support( 'lifterlms-sidebars' ); } add_action( 'after_setup_theme', 'buddyx_llms_theme_support' ); } /** * Example usage for learndash-focus-header-usermenu-after action. */ add_action( 'learndash-focus-header-usermenu-after', function( $course_id, $user_id ) { ?> ID; $title_overwrite = get_post_meta( $post_id, '_post_title_overwrite', true ); $title_position = get_post_meta( $post_id, '_post_title_position', true ); ?>

ID; $post_video = get_post_meta( $post_id, '_buddyx_post_video', true ); $post_audio = get_post_meta( $post_id, '_buddyx_post_audio', true ); $post_quote = get_post_meta( $post_id, '_buddyx_post_quote', true ); $post_quote_author = get_post_meta( $post_id, '_buddyx_post_quote_author', true ); $post_link_title = get_post_meta( $post_id, '_buddyx_post_link_title', true ); $post_link_url = get_post_meta( $post_id, '_buddyx_post_link_url', true ); $post_image_gallery = get_post_meta( $post_id, '_buddyx_image_gallery', true ); ?>

buddyboss ) ) { if ( ! empty( $blog_post_id ) && ! empty( get_post_thumbnail_id( $blog_post_id ) ) ) { $content .= sprintf( ' ', esc_url( get_permalink( $blog_post_id ) ), esc_url( wp_get_attachment_image_url( get_post_thumbnail_id( $blog_post_id ), 'full' ) ) ); } } return $content; } add_filter( 'buddyx_add_feature_image_blog_post_as_activity_content', 'buddyx_add_feature_image_blog_post_as_activity_content_callback', 10, 2 ); add_action( 'bp_before_activity_activity_content', 'buddyx_bp_blogs_activity_content_set_temp_content' ); /** * Function which set the temporary content on the blog post activity. * * @since 4.2.2 */ function buddyx_bp_blogs_activity_content_set_temp_content() { if ( function_exists( 'buddypress' ) && ! isset( buddypress()->buddyboss ) ) { global $activities_template; $activity = $activities_template->activity; if ( ( 'blogs' === $activity->component ) && isset( $activity->secondary_item_id ) && 'new_blog_' . get_post_type( $activity->secondary_item_id ) === $activity->type ) { $content = get_post( $activity->secondary_item_id ); // If we converted $content to an object earlier, flip it back to a string. if ( is_a( $content, 'WP_Post' ) ) { $activities_template->activity->content = '​'; } } elseif ( 'blogs' === $activity->component && 'new_blog_comment' === $activity->type && $activity->secondary_item_id && $activity->secondary_item_id > 0 ) { $activities_template->activity->content = '​'; } } } add_filter( 'bp_get_activity_content_body', 'buddyx_bp_blogs_activity_content_with_read_more', 9999, 2 ); /** * Function which set the content on activity blog post. * * @param $content * @param $activity * * @return string * * @since 4.2.2 */ function buddyx_bp_blogs_activity_content_with_read_more( $content, $activity ) { if ( function_exists( 'buddypress' ) && ! isset( buddypress()->buddyboss ) ) { if ( ( 'blogs' === $activity->component ) && isset( $activity->secondary_item_id ) && 'new_blog_' . get_post_type( $activity->secondary_item_id ) === $activity->type ) { $blog_post = get_post( $activity->secondary_item_id ); // If we converted $content to an object earlier, flip it back to a string. if ( is_a( $blog_post, 'WP_Post' ) ) { $content_img = apply_filters( 'buddyx_add_feature_image_blog_post_as_activity_content', '', $blog_post->ID ); $post_title = sprintf( '%s', esc_url( get_permalink( $blog_post->ID ) ), esc_html( $blog_post->post_title ) ); $content = bp_create_excerpt( bp_strip_script_and_style_tags( html_entity_decode( get_the_excerpt( $blog_post->ID ) ) ) ); if ( false !== strrpos( $content, __( '…', 'wp-rig' ) ) ) { $content = str_replace( ' […]', '…', $content ); $content = apply_filters_ref_array( 'bp_get_activity_content', array( $content, $activity ) ); preg_match( '/<\/iframe>/isU', $content, $matches ); if ( isset( $matches ) && array_key_exists( 0, $matches ) && ! empty( $matches[0] ) ) { $iframe = $matches[0]; $content = strip_tags( preg_replace( '//i', '', $content ), '' ); $content .= $iframe; } $content = sprintf( '%1$s
%2$s %3$s
', $content_img, $post_title, wpautop( $content ) ); } else { $content = apply_filters_ref_array( 'bp_get_activity_content', array( $content, $activity ) ); $content = strip_tags( $content, '