id_base ) { // Display the on_off_menu_two_clm option. $on_off_menu_two_clm = isset( $instance['on_off_menu_two_clm'] ) ? $instance['on_off_menu_two_clm'] : ''; ?>

/>

option_name); $widget_num = $widget_obj['params'][0]['number']; if (isset($widget_opt[$widget_num]['on_off_menu_two_clm'])){ $params[0]['before_widget'] = preg_replace('/class="/', 'class="two-column-menu ', $params[0]['before_widget'], 1); } return $params; } //Callback function for options update (priorität 5, 3 parameters) add_filter('widget_update_callback', 'upstudy_in_widget_form_update',5,3); //add class names (default priority, one parameter) add_filter('dynamic_sidebar_params', 'upstudy_dynamic_sidebar_params'); /** * return all the header items from eb_header post type * and theme default headers * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_fetch_header_layouts' ) ) : function upstudy_fetch_header_layouts() { $headers = apply_filters( 'upstudy_theme_header_types', array( 'theme-default-header' => 'Theme Default Header', 'theme-header-1' => 'Theme Header 01', 'theme-header-2' => 'Theme Header 02', 'theme-header-3' => 'Theme Header 03', ) ); $args = array( 'posts_per_page' => -1, 'offset' => 0, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'eb_header', 'post_status' => 'publish', 'suppress_filters' => true ); $posts = get_posts( $args ); foreach ( $posts as $post ) : $headers[$post->post_name] = $post->post_title; endforeach; return $headers; } endif; /** * return elementor header * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_get_header_config' ) ) : function upstudy_get_header_config() { global $post; if ( is_page() && is_object( $post ) && isset( $post->ID ) ) : $header = get_post_meta( $post->ID, '_upstudy_tpc_mb_elementor_header', true ); if ( empty( $header ) || $header == 'global' ) : return Upstudy::setting( 'upstudy_get_elementor_header' ); endif; return $header; endif; return Upstudy::setting( 'upstudy_get_elementor_header' ); } add_filter( 'upstudy_get_header_layout', 'upstudy_get_header_config' ); endif; /** * print Elementor Header * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_show_header_builder' ) ) : function upstudy_show_header_builder( $header_slug ) { $args = array( 'name' => $header_slug, 'post_type' => 'eb_header', 'post_status' => 'publish', 'numberposts' => 1 ); $posts = get_posts( $args ); $sticky_header = Upstudy::setting( 'sticky_header_enable' ) ?: false; foreach ( $posts as $post ) : $classes = array( 'upstudy-elementor-header-wrapper header-get-sticky' ); $classes[] = $post->post_name . '-' . $post->ID; $bg_color = ''; echo '
'; echo '
'; if ( $sticky_header ) : echo '
'; else : echo '
'; endif; echo apply_filters( 'upstudy_generate_post_builder', do_shortcode( $post->post_content ), $post, $post->ID ); echo '
'; echo '
'; echo '
'; endforeach; } endif; /** * return all the footer items from eb_footer post type * and theme default footers * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_get_footer_layouts' ) ) : function upstudy_get_footer_layouts() { $footers = apply_filters( 'upstudy_theme_footer_types', array( 'theme-default-footer' => 'Theme Default Footer' ) ); $args = array( 'posts_per_page' => -1, 'offset' => 0, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'eb_footer', 'post_status' => 'publish', 'suppress_filters' => true ); $posts = get_posts( $args ); foreach ( $posts as $post ) : $footers[$post->post_name] = $post->post_title; endforeach; return $footers; } endif; /** * return elementor footer * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_get_footer_config' ) ) : function upstudy_get_footer_config() { if ( is_page() ) { global $post; $footer = ''; if ( is_object( $post ) && isset( $post->ID ) ) : $footer = get_post_meta( $post->ID, '_upstudy_mb_elementor_footer', true ); if ( empty( $footer ) || $footer == 'global' ) : return Upstudy::setting( 'upstudy_get_elementor_footer' ); endif; endif; return $footer; } return Upstudy::setting( 'upstudy_get_elementor_footer' ); } add_filter( 'upstudy_get_footer_layout', 'upstudy_get_footer_config' ); endif; /** * print Elementor Footer * * @since 1.0.0 */ function upstudy_show_footer_builder( $footer_slug ) { $args = array( 'name' => $footer_slug, 'post_type' => 'eb_footer', 'post_status' => 'publish', 'numberposts' => 1 ); $posts = get_posts($args); foreach ( $posts as $post ) : $classes = array( 'upstudy-footer footer-builder-wrapper' ); $classes[] = $post->post_name; echo ''; endforeach; } /** * return category/single category with link * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_category_by_id' ) ) : function upstudy_category_by_id( $post_id = null, $taxonomy = 'category', $single = true ) { $terms = get_the_terms( $post_id, $taxonomy ); $cat = ''; $cat_with_link = ''; if ( is_array( $terms ) ) : foreach ( $terms as $tkey => $term ) : $cat .= $term->slug . ' '; $cat_with_link .= sprintf('%s', esc_url(get_category_link($term->term_id)), esc_html($term->name)); if ( $single ) : break; endif; endforeach; endif; return $cat_with_link; } endif; /** * get instructor lists from specific role type */ if ( ! function_exists( 'upstudy_get_all_instructors' ) ) : function upstudy_get_all_instructors( $user_role = 'lp_teacher' ) { $instructors = array(); $user_role = $user_role; $users = get_users( array( 'role__in' => array( $user_role ) ) ); if ( is_array( $users ) && ! empty( $users ) && ! is_wp_error( $users ) ) : $instructors = ['' => '']; foreach ( $users as $user ) : if ( isset( $user ) ) : $instructors[ $user->ID ] = $user->display_name.' [ID: '.$user->ID.']'; endif; endforeach; else : $instructors[0] = __( 'No Instructor found', 'upstudy' ); endif; return $instructors; } endif; /** * Get Social icons for instructors */ if ( ! function_exists( 'upstudy_user_social_icons' ) ) : function upstudy_user_social_icons( $user_id, $link_tab = '_blank' ) { $facebook = $twitter = $linkedin = $youtube = ''; if ( ! $user_id ) : $user_id = get_current_user_id(); endif; $facebook = get_the_author_meta( 'upstudy_facebook', $user_id ); $twitter = get_the_author_meta( 'upstudy_twitter', $user_id ); $linkedin = get_the_author_meta( 'upstudy_linkedin', $user_id ); $youtube = get_the_author_meta( 'upstudy_youtube', $user_id ); $facebook ? printf( '%s', esc_url( $facebook ), esc_attr( $link_tab ), esc_html__( 'Facebook', 'upstudy' ) ) : ''; $twitter ? printf( '%s', esc_url( $twitter ), esc_attr( $link_tab ), esc_html__( 'Twitter', 'upstudy' ) ) : ''; $linkedin ? printf( '%s', esc_url( $linkedin ), esc_attr( $link_tab ), esc_html__( 'Linkedin', 'upstudy' ) ) : ''; $youtube ? printf( '%s', esc_url( $youtube ), esc_attr( $link_tab ), esc_html__( 'Youtube', 'upstudy' ) ) : ''; } endif; /** * Get title */ if ( ! function_exists( 'upstudy_get_title' ) ) : function upstudy_get_title( $tag = 'h4', $extra_class = null ) { $title = get_the_title(); $class = 'get__title'; if ( 0 === mb_strlen( $title ) ) : $title = ' '; $class = 'get__title-link'; endif; if ( $extra_class ) : $class .= ' ' . $extra_class; endif; if ( ! empty( $title ) ) : return '<' . esc_attr( $tag ) . ' class="' . esc_attr( $class ). '">' . wp_kses_post( $title ) . ''; endif; return ''; } endif; /** * Logo Setup */ if ( ! function_exists( 'upstudy_logo_setup' ) ) : function upstudy_logo_setup(){ global $post; echo '
'; if ( is_page() && is_object( $post ) && function_exists( 'upstudy_child_theme_is_activated' ) && upstudy_child_theme_is_activated() ) : $page_custom_logo = get_post_meta( get_the_ID(), 'upstudy_page_header_logo', true ); if ( isset( $page_custom_logo ) && ! empty( $page_custom_logo ) ) : echo ''; upstudy_white_logo(); echo '
'; return; endif; endif; if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) : the_custom_logo(); else : echo ''; endif; upstudy_white_logo(); echo ''; } endif; /** * White Logo */ if ( ! function_exists( 'upstudy_white_logo' ) ) : function upstudy_white_logo() { global $post; $white_logo = Upstudy::setting( 'header_white_logo' ); if ( isset( $white_logo ) && ! empty( $white_logo ) ) : $white_logo = $white_logo; else : $white_logo = ''; endif; if ( is_page() && is_object( $post ) && function_exists( 'upstudy_child_theme_is_activated' ) ) : $page_white_logo = get_post_meta( get_the_ID(), 'upstudy_page_header_white_logo', true ); if ( isset( $page_white_logo ) && ! empty( $page_white_logo ) ) : $white_logo = $page_white_logo; endif; endif; if ( isset( $white_logo ) && ! empty( $white_logo ) ) : echo ''; endif; } endif; /** * Menu Setup */ if ( ! function_exists( 'upstudy_menu_setup' ) ) : function upstudy_menu_setup(){ if ( has_nav_menu( 'primary' ) ) : echo '';//#site-navigation endif; } endif; /** * Responsive Menu Setup */ if ( ! function_exists( 'upstudy_responsive_menu_setup' ) ) : function upstudy_responsive_menu_setup(){ if ( has_nav_menu( 'primary' ) ) : echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; wp_nav_menu( array( 'theme_location' => 'primary', 'depth' => 8, 'container' => 'ul', 'menu_id' => 'upstudy-mobile-menu-item', 'menu_class' => 'upstudy-mobile-menu-item', 'fallback_cb' => 'Upstudy_NavWalker::fallback', 'walker' => new Upstudy\Navwalker\Upstudy_NavWalker() ) ); echo '
'; echo '
'; endif; } endif; /** * change default logo class */ add_filter( 'get_custom_logo', 'upstudy_logo_class' ); if ( ! function_exists( 'upstudy_logo_class' ) ) : function upstudy_logo_class( $html ) { $html = str_replace( 'custom-logo-link', 'navbar-brand site-main-logo', $html ); $html = str_replace( 'custom-logo', 'site-logo', $html ); return $html; } endif; /** * Header Search Field */ if ( ! function_exists( 'upstudy_header_search_field' ) ) : function upstudy_header_search_field( $extra_class = null ) { if ( $extra_class ) : $extra_class = ' ' . $extra_class; endif; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; } endif; /** * Header Search Modal PopUp for enter site */ if ( ! function_exists( 'upstudy_whole_search_modal_popup' ) ) : function upstudy_whole_search_modal_popup() { $search_type = Upstudy::setting( 'upstudy_search_style' ); if ( class_exists( 'Upstudy_Core' )) { echo ''; } //end (function_exists( 'Upstudy_Core' )) } endif; /** * Header Search Modal PopUp for LMS courses */ if ( ! function_exists( 'upstudy_lms_course_search_modal_popup' ) ) : function upstudy_lms_course_search_modal_popup() { $search_type = Upstudy::setting( 'upstudy_search_style' ); echo ''; } endif; /** * Exclude Elementor Header & Footer custom post types from WordPress search results */ if ( ! function_exists( 'upstudy_exclude_header_footer_from_search' ) ) { function upstudy_exclude_header_footer_from_search( $query ) { // Apply only on frontend main search query if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { // Get current post types $post_types = $query->get( 'post_type' ); // If no post type is defined, limit search to posts & pages if ( empty( $post_types ) ) { $post_types = array( 'post', 'page' ); } // Exclude Elementor Header & Footer CPT $excluded_post_types = array( 'eb_header', 'eb_footer', ); // Set filtered post types $query->set( 'post_type', array_diff( (array) $post_types, $excluded_post_types ) ); } } add_action( 'pre_get_posts', 'upstudy_exclude_header_footer_from_search' ); } /** * Header User Login / Register */ if ( ! function_exists( 'upstudy_header_user_login_option' ) ) : function upstudy_header_user_login_option( $icon_with_text = false ) { echo '
'; if ( $icon_with_text ) : echo '' . __( 'Login / Register', 'upstudy' ). ''; else : echo ''; endif; echo '
'; } endif; /** * Header User Login / Register( alter ) */ if ( ! function_exists( 'upstudy_header_user_login_option_alter' ) ) : function upstudy_header_user_login_option_alter( $icon_with_text = false ) { echo '
'; if ( is_user_logged_in() ) : $user_id = get_current_user_id(); $user = get_userdata( $user_id ); if ( function_exists( 'learn_press_get_page_link' ) ) : $profile_url = learn_press_get_page_link( 'profile' ); echo ''; echo get_avatar( $user_id, 100 ); echo ''; else : echo get_avatar( $user_id, 100 ); endif; else : if ( $icon_with_text ) : echo '' . __( 'Login / Register', 'upstudy' ) . ''; else : echo ''; endif; endif; echo '
'; } endif; /** * Header Category */ if ( ! function_exists( 'upstudy_header_category' ) ) : function upstudy_header_category( $extra_class = null ) { $cat_status = Upstudy::setting( 'header_category_show' ); if ( ! $cat_status ) : return; endif; $class = "header-category"; if ( $extra_class ) : $class .= ' ' . $extra_class; endif; $title = Upstudy::setting( 'heading_category_title' ) ? Upstudy::setting( 'heading_category_title' ) : __( 'Category', 'upstudy' ); echo '
'; echo ''; echo '
'; } endif; /** * Header Category Items */ if ( ! function_exists( 'upstudy_header_category_items' ) ) : function upstudy_header_category_items() { $total_cat_to_show = Upstudy::setting( 'heading_category_items' ); $total_cat_to_show = intval( $total_cat_to_show ); $cat_slug = apply_filters( 'upstudy_header_course_lms_cat_slug', 'course_category' ); $args = [ 'taxonomy' => $cat_slug, 'orderby' => 'name', 'show_count' => 0, 'title_li' => '', 'hide_empty' => 1, 'number' => $total_cat_to_show ]; $args = apply_filters( 'upstudy_header_course_category_args', $args ); $categories = get_categories( $args ); if ( is_array( $categories ) && ! empty( $categories ) ) : foreach ( $categories as $category ) : echo '
  • '; echo ''; echo esc_html( $category->name ); echo ''; echo '
  • '; endforeach; else : echo '
  • ' . esc_html( 'No Category Found', 'upstudy' ) . '
  • '; endif; } endif; /** * Header Category Only Parent Items * by activating the following filter * only parent category will be visible */ // add_filter( 'upstudy_header_course_category_args', 'upstudy_header_category_only_parent' ); if ( ! function_exists( 'upstudy_header_category_only_parent' ) ) : function upstudy_header_category_only_parent( $args ) { $extra_args = wp_parse_args( [ 'parent' => 0 ], $args ); return $extra_args; } endif; /** * Header Button */ if ( ! function_exists( 'upstudy_header_button' ) ) : function upstudy_header_button( $extra_class = null ) { $header_button_show = Upstudy::setting( 'header_button_show' ); $button_text = Upstudy::setting( 'header_button_text' ); $button_url = Upstudy::setting( 'header_button_url' ); $same_tab = Upstudy::setting( 'header_button_open_same_tab' ); if ( $same_tab ) : $tab = '_self'; else : $tab = '_blank'; endif; if ( $extra_class ) : $extra_class = ' ' . $extra_class; endif; if ( $header_button_show && $button_text ) : echo '' . wp_kses_post( $button_text ) . ''; elseif ($header_button_show && $button_text ) : echo '' . __( 'Try for free', 'upstudy' ) . ''; endif; } endif; /** * Header Responsive Menu Toggle */ if ( ! function_exists( 'upstudy_header_responsive_toggle' ) ) : function upstudy_header_responsive_toggle() { echo '
    '; echo '
    '; echo ''; echo ''; echo ''; echo '
    '; echo '
    '; } endif; /** * Add to cart for WC */ /** ------------------------- * Unified header cart (Woo + Tutor Native) * Replace old cart functions with this block * ------------------------- */ if ( ! function_exists( 'upstudy_header_cart_icon' ) ) : function upstudy_header_cart_icon() { // Detect active systems $is_wc_active = class_exists( 'WooCommerce' ); $is_tutor_active = class_exists( 'Tutor\Ecommerce\CartController' ) && function_exists( 'tutor_utils' ) && 'tutor' === tutor_utils()->get_option( 'monetize_by' ); // Woo count (safe) $woo_count = 0; if ( $is_wc_active && function_exists( 'WC' ) && WC() && WC()->cart ) { $woo_count = WC()->cart->get_cart_contents_count(); } // Tutor count & items (use CartController for stability) $tutor_count = 0; $tutor_items = array(); if ( $is_tutor_active ) { $cart_controller = new Tutor\Ecommerce\CartController(); $get_cart = $cart_controller->get_cart_items(); if ( isset( $get_cart['courses'] ) ) { $courses = $get_cart['courses']; $tutor_count = isset( $courses['total_count'] ) ? intval( $courses['total_count'] ) : 0; $tutor_items = isset( $courses['results'] ) ? $courses['results'] : array(); } } $total_count = intval( $woo_count + $tutor_count ); // choose link target: prefer WC cart URL if WC active $cart_url = '#'; if ( $is_wc_active ) { $cart_url = wc_get_cart_url(); } elseif ( $is_tutor_active ) { // Use Tutor LMS Native Cart URL instead of dashboard enrolled courses if ( class_exists( 'Tutor\Ecommerce\CartController' ) ) { $cart_url = \Tutor\Ecommerce\CartController::get_page_url(); } } // Output fragment (id matches Woo fragment key) echo '
    '; echo '
    '; echo '
    '; printf( '', esc_attr( 'upstudy-woo-mini-cart-link upstudy-woo-mini-cart-visible-on-hover' ), esc_url( $cart_url ) ); printf( '%2$s', esc_attr( 'upstudy-woo-mini-cart-total-item' ), esc_html( $total_count ) ); echo '
    '; echo '
    '; // 1) WooCommerce mini cart (if active) if ( $is_wc_active ) { // This will echo standard woo mini cart html woocommerce_mini_cart(); } // 2) Tutor LMS native cart items (if any) if ( $is_tutor_active && ! empty( $tutor_items ) ) { echo '
    '; foreach ( $tutor_items as $course ) { // $course is object with ->ID and ->post_title (as earlier in your code) $course_id = isset( $course->ID ) ? $course->ID : 0; $course_title = isset( $course->post_title ) ? $course->post_title : ''; $thumb = get_tutor_course_thumbnail_src( '', $course_id ); $price_obj = tutor_utils()->get_raw_course_price( $course_id ); $reg = isset( $price_obj->regular_price ) ? $price_obj->regular_price : 0; $sale = isset( $price_obj->sale_price ) ? $price_obj->sale_price : 0; $display_price = $sale ? $sale : $reg; $formatted = function_exists( 'tutor_get_formatted_price' ) ? tutor_get_formatted_price( $display_price ) : $display_price; echo '
    '; echo '
    '; echo ''; echo '' . esc_attr( $course_title ) . ''; echo ''; echo '
    '; echo '
    '; echo '' . esc_html( $course_title ) . ''; echo '1 × ' . $formatted . ''; echo '
    '; echo '×'; echo '
    '; } echo '
    '; } // if nothing to show if ( empty( $tutor_items ) && ! $is_wc_active ) { echo '
    '; echo '

    ' . esc_html__( 'No items in the cart', 'upstudy' ) . '

    '; echo '
    '; } echo '
    '; // .widget_shopping_cart_content echo '
    '; // .upstudy-woo-mini-cart-content echo '
    '; // .upstudy-woo-mini-cart-icon-wrapper echo '
    '; // .upstudy-woo-mini-cart-inner echo '
    '; // .upstudy-woo-mini-cart-wrapper } endif; /** Woo fragment filter (Kept so Woo's add_to_cart fragments still work) */ add_filter( 'woocommerce_add_to_cart_fragments', 'upstudy_cart_icon_fragment' ); function upstudy_cart_icon_fragment( $fragments ) { ob_start(); upstudy_header_cart_icon(); $fragments['#upstudy-cart-fragment'] = ob_get_clean(); return $fragments; } /** Fallback AJAX endpoint to return same fragment HTML (used when Woo fragments not available) */ add_action( 'wp_ajax_upstudy_refresh_cart_fragment', 'upstudy_refresh_cart_fragment' ); add_action( 'wp_ajax_nopriv_upstudy_refresh_cart_fragment', 'upstudy_refresh_cart_fragment' ); function upstudy_refresh_cart_fragment() { ob_start(); upstudy_header_cart_icon(); $html = ob_get_clean(); wp_send_json_success( array( 'fragment' => $html ) ); } /** * Register fragment with WooCommerce */ // add_filter( 'woocommerce_add_to_cart_fragments', 'upstudy_cart_icon_fragment' ); // function upstudy_cart_icon_fragment( $fragments ) { // ob_start(); // upstudy_header_cart_icon(); // $fragments['#upstudy-cart-fragment'] = ob_get_clean(); // return $fragments; // } /** * Header Cart Icon for Tutor LMS Native Monetization */ /** * Header Cart Icon for Tutor LMS Native Monetization */ // if ( ! function_exists( 'upstudy_tutor_native_cart_icon' ) ) : // function upstudy_tutor_native_cart_icon() { // // Check if Tutor LMS is active with Native monetization // if ( function_exists( 'tutor' ) && class_exists( 'Tutor\Ecommerce\CartController' ) ) { // // Get cart data from Tutor LMS // $cart_controller = new Tutor\Ecommerce\CartController(); // $get_cart = $cart_controller->get_cart_items(); // $courses = $get_cart['courses']; // $total_count = $courses['total_count']; // $course_list = $courses['results']; // $cart_url = ''; // $checkout_url = ''; // if (class_exists('Tutor\Ecommerce\CheckoutController')) { // $cart_url = Tutor\Ecommerce\CheckoutController::get_page_url(); // $checkout_url = $cart_url ? str_replace('/cart/', '/checkout/', $cart_url) : '#'; // } // echo '
    '; // echo '
    '; // echo '
    '; // echo ''; // echo ''; // echo ''; // echo ''; // echo esc_html( $total_count ); // echo ''; // echo '
    '; // echo '
    '; // if ( is_array( $course_list ) && count( $course_list ) ) { // echo '
    '; // // Calculate subtotal // $subtotal = 0; // foreach ( $course_list as $key => $course ) { // $course_price = tutor_utils()->get_raw_course_price( $course->ID ); // $regular_price = $course_price->regular_price; // $sale_price = $course_price->sale_price; // $display_price = $sale_price ? $sale_price : $regular_price; // $subtotal += $display_price; // $tutor_course_img = get_tutor_course_thumbnail_src( '', $course->ID ); // $course_title = esc_html( $course->post_title ); // $formatted_price = tutor_get_formatted_price( $display_price ); // echo '
    '; // echo '
    '; // echo ''; // echo '' . esc_attr( $course_title ) . ''; // echo ''; // echo '
    '; // echo '
    '; // echo '' . $course_title . ''; // echo '1 × '; // echo ''; // echo $formatted_price; // echo ''; // echo ''; // echo '
    '; // echo '×'; // echo '
    '; // } // echo '
    '; // // Format the subtotal for display // $formatted_subtotal = tutor_get_formatted_price( $subtotal ); // echo '

    '; // echo '' . esc_html__( 'Subtotal:', 'tutor' ) . ''; // echo ''; // echo ''; // echo $formatted_subtotal; // echo ''; // echo ''; // echo '

    '; // echo '

    '; // echo '' . esc_html__( 'View cart', 'tutor' ) . ''; // echo '' . esc_html__( 'Checkout', 'tutor' ) . ''; // echo '

    '; // } else { // echo '
    '; // echo '

    ' . esc_html__( 'No courses in the cart', 'tutor' ) . '

    '; // if ( function_exists( 'tutor_utils' ) ) { // echo ''; // } // echo '
    '; // } // echo '
    '; // echo '
    '; // echo '
    '; // echo '
    '; // echo '
    '; // // Add JavaScript for cart functionality // echo ''; // } else { // return; // } // } // endif; /** * Header Search Icon */ if ( ! function_exists( 'upstudy_header_search_toggle' ) ) : function upstudy_header_search_toggle() { echo '
    '; echo '
    '; echo ''; echo '
    '; echo '
    '; } endif; /** * Theme main header */ add_action( 'upstudy_main_header', 'upstudy_header_setup' ); if ( ! function_exists( 'upstudy_header_setup' ) ) : function upstudy_header_setup() { $default_headers = array( 'theme-default-header', 'theme-header-1', 'theme-header-2', 'theme-header-3', 'theme-header-4', 'theme-header-5', ); $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ?: 'theme-default-header'); $sticky_header = Upstudy::setting( 'sticky_header_enable' ) ?: false; $upstudy_transparent_header = upstudy::setting( 'upstudy_transparent_header' ) ?: false; $dark_header_enable = Upstudy::setting( 'dark_header_enable' ); $classes[] = 'site-header'; $classes[] = $header; if ( $dark_header_enable ) : $classes[] = 'upstudy-dark-header'; endif; if ( $sticky_header ) : $classes[] = 'header-get-sticky'; endif; if ( $upstudy_transparent_header ) : $classes[] = 'upstudy-transparent-header'; endif; $upstudy_transparent_header_white_color = Upstudy::setting( 'upstudy_transparent_header_white_color' ) ; if ( $upstudy_transparent_header && $upstudy_transparent_header_white_color) : $classes[] = 'header-color-white'; endif; if ( $upstudy_transparent_header && $upstudy_transparent_header_white_color) : $classes[] = 'white-logo-enable'; endif; $classes = apply_filters( 'upstudy_header_class_array', $classes ); if ( 'none' !== $header ) : if ( in_array( $header, $default_headers ) || empty( $header ) ) : echo '
    '; upstudy_header_top_bar(); upstudy_header(); echo '
    '; //#masthead // responsive menu upstudy_responsive_menu_setup(); else : upstudy_show_header_builder( $header ); endif; endif; } endif; /** * Theme header */ if ( ! function_exists( 'upstudy_header' ) ) : function upstudy_header(){ $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ) ?: 'theme-default-header'; $container_class = 'upstudy-container-fluid'; if ( 'theme-default-header' === $header || 'theme-header-2' === $header ) : $container_class = 'upstudy-container'; endif; $search_field = $header_btn = ''; echo '
    '; echo '
    '; echo '
    '; echo '
    '; upstudy_logo_setup(); echo '
    '; if ( 'theme-header-1' === $header ) : upstudy_header_category(); endif; if ( 'theme-header-1' === $header ) : upstudy_header_search_field( $search_field ); endif; echo '
    '; upstudy_menu_setup(); echo '
    '; if ( Upstudy::setting( 'login_popup_active' ) || Upstudy::setting( 'top_search_enable' ) || Upstudy::setting( 'top_cart_enable' ) ) { upstudy_header_right_side_content(); } echo '
    '; echo '
    '; echo '
    '; } endif; /** * Theme header Right Side Content */ if ( ! function_exists( 'upstudy_header_right_side_content' ) ) : function upstudy_header_right_side_content(){ $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ) ?: 'theme-default-header'; $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $top_logout_button_text = Upstudy::setting( 'top_logout_button_text' ); $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $profile_show = Upstudy::setting( 'profile_show' ); $login_reg_show = Upstudy::setting( 'login_reg_show' ); $top_login_button_text = Upstudy::setting( 'top_login_button_text' ); $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $top_logout_button_text = Upstudy::setting( 'top_logout_button_text' ); $get_the_top_login_button_text = $top_login_button_text ? $top_login_button_text : __( 'Login', 'upstudy' ); $get_the_top_register_button_text = $top_register_button_text ? $top_register_button_text : __( 'Register', 'upstudy' ); $get_the_custom_login_link = ( !empty( $custom_login_link ) ) ? $custom_login_link : wp_login_url( home_url('/') ); $search_field = $header_btn = ''; echo '
    '; do_action( 'upstudy_header_right_before_content' ); if ( 'theme-header-4' === $header ) : upstudy_header_top_social_share(); endif; if ( 'theme-default-header' === $header || 'theme-header-1' === $header || 'theme-header-2' === $header || 'theme-header-3' === $header ) { if ( Upstudy::setting( 'login_popup_active' ) ) : if ( function_exists( 'upstudy_user_profile_menu' ) && is_user_logged_in() && $profile_show ) : upstudy_user_profile_menu(); endif; if( ! is_user_logged_in() && $login_reg_show) : upstudy_popup_none_only_login_button(); endif; else : // Login Popup fall back $custom_login_link = Upstudy::setting( 'custom_login_link' ); $get_the_custom_login_link = ( !empty( $custom_login_link ) ) ? $custom_login_link : wp_login_url( home_url('/') ); if($login_reg_show){ echo '
    '; if( ! is_user_logged_in() ) : echo ''; else : if ( function_exists( 'upstudy_user_profile_menu' ) && is_user_logged_in() && $profile_show ) : upstudy_user_profile_menu(); endif; endif; echo '
    '; } endif; // End Login Popup condition } // End header condition if ( 'theme-header-1' !== $header){ if ( Upstudy::setting( 'top_search_enable' ) ) : upstudy_header_search_toggle(); endif; } if ( Upstudy::setting( 'top_cart_enable' ) ) : upstudy_header_cart_icon(); endif; if( Upstudy::setting( 'header_button_show' )) : upstudy_header_button( $header_btn ); endif; do_action( 'upstudy_header_right_after_content' ); upstudy_header_responsive_toggle(); echo '
    '; } endif; /** * Theme header top bar */ if ( ! function_exists( 'upstudy_header_top_bar' ) ) : function upstudy_header_top_bar() { global $post; $top_bar = Upstudy::setting( 'header_top_show' ); $top_bar_type = Upstudy::setting( 'header_top_bar_style' ); if ( is_page() && is_object( $post ) ) : $page_top_bar = get_post_meta( get_the_ID(), '_upstudy_page_header_top_show', true ); $page_top_bar_type = get_post_meta( get_the_ID(), '_upstudy_page_header_top_bar_style', true ); if ( 'enable' === $page_top_bar ) : $top_bar = true; elseif ( 'disable' === $page_top_bar ) : $top_bar = false; endif; if ( '1' === $page_top_bar_type || '2' === $page_top_bar_type ) : $top_bar_type = $page_top_bar_type; endif; endif; $container_class = 'upstudy-container-fluid'; if ( '2' === $top_bar_type || '3' === $top_bar_type ) : $container_class = 'upstudy-container'; endif; if ( $top_bar ) : echo '
    '; echo '
    '; echo '
    '; if ( '1' === $top_bar_type ) : upstudy_header_top_01(); elseif ( '2' === $top_bar_type ) : upstudy_header_top_02(); elseif ( '3' === $top_bar_type ) : upstudy_header_top_03(); else : upstudy_header_top_01(); endif; echo '
    '; echo '
    '; echo '
    '; endif; } endif; /** * Theme header top social share */ if ( ! function_exists( 'upstudy_header_top_social_share' ) ) : function upstudy_header_top_social_share() { $enable_social_handle = Upstudy::setting( 'enable_social_handle' ); $upstudy_social_links = Upstudy::setting( 'upstudy_social_links' ); $social_newtab = Upstudy::setting( 'social_newtab' ); $follow_us_show = Upstudy::setting( 'follow_us_show' ); $follow_us_text = Upstudy::setting( 'follow_us_text' ); echo '
    '; echo ''; if($follow_us_show) { if($follow_us_text) { echo esc_html($follow_us_text); } else { echo esc_html__( 'Follow Us :', 'upstudy' ); } } echo ''; foreach($upstudy_social_links as $upstudy_social_handle) : if (!empty($upstudy_social_handle)) { echo ''; echo ''; echo ''; } endforeach; echo '
    '; } endif; /** * Theme header top bar 1 */ if ( ! function_exists( 'upstudy_header_top_01' ) ) : function upstudy_header_top_01() { $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ); $top_massage = Upstudy::setting( 'top_massage' ); $top_massage_area_width = Upstudy::setting( 'top_massage_area_width' ); $top_massage_animation_show = Upstudy::setting( 'top_massage_animation_show' ); $phone = Upstudy::setting( 'top_phone' ); $top_phone_link = Upstudy::setting( 'top_phone_link' ); $email = Upstudy::setting( 'top_email' ); $top_email_link = Upstudy::setting( 'top_phone_email' ); $header_top_button_show = Upstudy::setting( 'header_top_button_show' ); $button_text = Upstudy::setting( 'header_top_button_text' ); $button_url = Upstudy::setting( 'header_top_button_url' ); $same_tab = Upstudy::setting( 'header_top_button_open_same_tab' ); $social_icons = Upstudy::setting( 'enable_social_handle' ); $custom_logout_link = Upstudy::setting( 'custom_logout_link' ); $custom_login_link = Upstudy::setting( 'custom_login_link' ); $custom_register_link = Upstudy::setting( 'custom_register_link' ); $top_login_button_text = Upstudy::setting( 'top_login_button_text' ); $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $top_logout_button_text = Upstudy::setting( 'top_logout_button_text' ); if ( $same_tab ) : $tab = '_self'; else : $tab = '_blank'; endif; if ( $email || $phone) : echo '
    '; if ( $phone ) : echo '
    '; if ( !empty($top_phone_link) ) { echo ' ' . esc_html($phone) . ''; } else { // If the option is disabled, just display the phone number without the anchor tag. echo ' ' . esc_html($phone); } echo '
    '; endif; if ( $email ) : echo '
    '; if ( ! empty( $top_email_link ) ) { echo '' . esc_html( $email ) . ''; } else { echo '' . esc_html( $email ) . ''; } echo '
    '; endif; echo '
    '; endif; echo '
    '; if ( $top_massage ) : echo '
    '; if ( $top_massage_animation_show ) { echo ''; } echo wp_kses_post( $top_massage ); if ( $top_massage_animation_show ) { echo ''; } echo '
    '; endif; echo '
    '; echo '
    '; if ( $social_icons && 'theme-header-4' !== $header) : upstudy_header_top_social_share(); endif; $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $top_logout_button_text = Upstudy::setting( 'top_logout_button_text' ); $top_register_button_text = Upstudy::setting( 'top_register_button_text' ); $profile_show = Upstudy::setting( 'profile_show' ); $login_reg_show = Upstudy::setting( 'login_reg_show' ); $get_the_top_login_button_text = $top_login_button_text ? $top_login_button_text : __( 'Login', 'upstudy' ); $get_the_top_register_button_text = $top_register_button_text ? $top_register_button_text : __( 'Register', 'upstudy' ); $get_the_custom_login_link = ( !empty( $custom_login_link ) ) ? $custom_login_link : wp_login_url( home_url('/') ); if ( is_active_sidebar( 'header-top' ) ) { echo '
    '; dynamic_sidebar( 'header-top' ); echo '
    '; } if ( $header_top_button_show ) : if ( $button_text ) : echo '
    '; echo '' . wp_kses_post( $button_text ) . ''; echo '
    '; else : echo '
    '; echo 'Apply Now'; echo '
    '; endif; endif; echo '
    '; } endif; /** * Theme header top bar 2 */ if ( ! function_exists( 'upstudy_header_top_02' ) ) : function upstudy_header_top_02() { $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ); $top_massage = Upstudy::setting( 'top_massage' ); $top_massage_area_width = Upstudy::setting( 'top_massage_area_width' ); $top_massage_animation_show = Upstudy::setting( 'top_massage_animation_show' ); $phone = Upstudy::setting( 'top_phone' ); $top_phone_link = Upstudy::setting( 'top_phone_link' ); $email = Upstudy::setting( 'top_email' ); $top_email_link = Upstudy::setting( 'top_phone_email' ); $header_top_button_show = Upstudy::setting( 'header_top_button_show' ); $button_text = Upstudy::setting( 'header_top_button_text' ); $button_url = Upstudy::setting( 'header_top_button_url' ); $same_tab = Upstudy::setting( 'header_top_button_open_same_tab' ); $social_icons = Upstudy::setting( 'enable_social_handle' ); if ( $same_tab ) : $tab = '_self'; else : $tab = '_blank'; endif; if ( $email || $phone) : echo '
    '; if ( $phone ) : echo '
    '; if ( !empty($top_phone_link) ) { echo ' ' . esc_html($phone) . ''; } else { // If the option is disabled, just display the phone number without the anchor tag. echo ' ' . esc_html($phone); } echo '
    '; endif; if ( $email ) : echo '
    '; if ( ! empty( $top_email_link ) ) { echo '' . esc_html( $email ) . ''; } else { echo '' . esc_html( $email ) . ''; } echo '
    '; endif; echo '
    '; endif; echo '
    '; if ( $top_massage ) : echo '
    '; if ( $top_massage_animation_show ) { echo ''; } echo wp_kses_post( $top_massage ); if ( $top_massage_animation_show ) { echo ''; } echo '
    '; endif; echo '
    '; echo '
    '; if ( $social_icons && 'theme-header-4' !== $header) : upstudy_header_top_social_share(); endif; if ( $header_top_button_show ) : if ( $button_text ) : echo '
    '; echo '' . wp_kses_post( $button_text ) . ''; echo '
    '; else : echo '
    '; echo 'Apply Now'; echo '
    '; endif; endif; echo '
    '; } endif; /** * Theme header top bar 3 */ if ( ! function_exists( 'upstudy_header_top_03' ) ) : function upstudy_header_top_03() { $header = apply_filters( 'upstudy_get_header_layout', Upstudy::setting( 'upstudy_get_elementor_header' ) ); $top_massage = Upstudy::setting( 'top_massage' ); $top_massage_area_width = Upstudy::setting( 'top_massage_area_width' ); $top_massage_animation_show = Upstudy::setting( 'top_massage_animation_show' ); $phone = Upstudy::setting( 'top_phone' ); $top_phone_link = Upstudy::setting( 'top_phone_link' ); $email = Upstudy::setting( 'top_email' ); $top_email_link = Upstudy::setting( 'top_phone_email' ); $button_text = Upstudy::setting( 'header_button_text' ); $button_url = Upstudy::setting( 'header_button_url' ); $same_tab = Upstudy::setting( 'header_button_open_same_tab' ); $social_icons = Upstudy::setting( 'enable_social_handle' ); if ( $same_tab ) : $tab = '_self'; else : $tab = '_blank'; endif; echo '
    '; if ( $top_massage ) : echo '
    '; if ( $top_massage_animation_show ) { echo ''; } echo wp_kses_post($top_massage); if ( $top_massage_animation_show ) { echo ''; } echo '
    '; else : if ( $top_massage_animation_show ) { echo ''; } echo "Add your notice in top message option! & Enabled the animation options"; if ( $top_massage_animation_show ) { echo ''; } endif; echo '
    '; } endif; /** * theme after header * page title & breadcrumb */ add_action( 'upstudy_after_header', 'upstudy_breadcrumb_display' ); if ( ! function_exists( 'upstudy_breadcrumb_display' ) ) : function upstudy_breadcrumb_display() { global $post; $breadcrumb = ''; $has_bg_image = ''; $show = true; $style = array(); $global_breadcrumb_visibility = Upstudy::setting( 'page_header_show' ) ?: true; if ( upstudy_is_lms_course_details() ) : return; endif; if ( $global_breadcrumb_visibility ) : $global_breadcrumb_type = Upstudy::setting( 'page_title_bg_type' ) ?: 'image'; if ( 'image' === $global_breadcrumb_type ) : $global_breadcrumb_img = get_header_image(); if ( isset( $global_breadcrumb_img ) && ! empty( $global_breadcrumb_img ) ) : $style[] = 'background-image:url(\'' . esc_url( $global_breadcrumb_img ) . '\' )'; $has_bg_image = 'upstudy-breadcrumb-has-bg'; endif; elseif ( 'color' === $global_breadcrumb_type ) : $breadcrumb_color = Upstudy::setting( 'header_banner_overlay_color' ) ?: 'header_image'; if ( $breadcrumb_color ) : $style[] = 'background-color:' . esc_attr( $breadcrumb_color ); endif; endif; else : return; endif; if ( is_page() && is_object( $post ) ) : $breadcrumb_visibility = get_post_meta( get_the_ID(), '_upstudy_page_header_enable', true ); $breadcrumb_show_framework = Upstudy::setting( 'page_header_show' ) ?: true; if ( 'disable' !== $breadcrumb_visibility ) : if ( ( 'enable' === $breadcrumb_visibility ) || ( isset( $breadcrumb_show_framework ) && ! empty( $breadcrumb_show_framework ) ) ) : $default_breadcrumb_at_page = true; $bg_meta_image = get_post_meta( get_the_ID(), '_upstudy_header_img', true ); $bg_meta_color = get_post_meta( get_the_ID(), '_upstudy_page_title_bg_color', true ); $bg_framework_image = get_header_image(); $bg_framework_color = Upstudy::setting( 'header_banner_overlay_color' ) ?: 'header_image'; if ( $bg_meta_color ) : $style[] = 'background-color:' . $bg_meta_color; elseif ( $bg_framework_color ) : $style[] = 'background-color:' . $bg_framework_color; endif; if ( $bg_meta_image ) : $style[] = 'background-image:url(\''.esc_url( $bg_meta_image ).'\' )'; $has_bg_image = 'upstudy-breadcrumb-has-bg'; elseif ( ! $default_breadcrumb_at_page ) : $breadcrumb_img = get_header_image(); if ( isset( $breadcrumb_img['url'] ) && ! empty( $breadcrumb_img['url'] ) ) : $style[] = 'background-image:url(\'' . esc_url( $breadcrumb_img['url'] ) . '\' )'; $has_bg_image = 'upstudy-breadcrumb-has-bg'; endif; endif; else : return ''; endif; else : return ''; endif; endif; $title = upstudy_get_page_title(); $extra_style = ! empty( $style ) ? ' style="' . implode( "; ", $style ) . '"' : ""; $page_title_style = Upstudy::setting( 'page_title_style' ) ?: true; if ( is_page() && is_object( $post ) ) : $page_breadcrumb_style = get_post_meta( get_the_ID(), '_upstudy_page_title_style', true ); if ( $page_breadcrumb_style === 'global' || empty( $page_breadcrumb_style ) || ! isset( $page_breadcrumb_style ) ) : $page_title_style = $page_title_style; else : $page_title_style = $page_breadcrumb_style; endif; endif; if ( isset( $_GET['breadcrumb_preset'] ) ) : $page_title_style = in_array( $_GET['breadcrumb_preset'], array( 'default', '1', '2' ) ) ? $_GET['breadcrumb_preset'] : 'default'; endif; $page_title_style = apply_filters( 'upstudy_breadcrumb_style', $page_title_style ); if ( '1' === $page_title_style ) : upstudy_breadcrumb_style_1( $title, $has_bg_image, $extra_style ); elseif ( '2' === $page_title_style ) : upstudy_breadcrumb_style_2( $title, $has_bg_image, $extra_style ); else: upstudy_breadcrumb_default_style( $title ); endif; } endif; /** * theme after header * Blog overlay header */ add_action( 'upstudy_blog_image_overlay_header', 'upstudy_blog_header_layout_image_overlay' ); if ( ! function_exists( 'upstudy_blog_header_layout_image_overlay' ) ) : function upstudy_blog_header_layout_image_overlay() { // echo "I am from image overlay header"; global $post; $breadcrumb = ''; $has_bg_image = ''; $show = true; $style = array(); $global_breadcrumb_visibility = Upstudy::setting( 'page_header_show' ) ?: true; if ( has_post_thumbnail() ) { $global_breadcrumb_type = Upstudy::setting( 'page_title_bg_type' ) ?: 'image'; $global_breadcrumb_img = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); $style[] = 'background-image:url(\'' . esc_url( $global_breadcrumb_img ) . '\' )'; $has_bg_image = 'upstudy-breadcrumb-has-bg'; }else { $global_breadcrumb_type = Upstudy::setting( 'page_title_bg_type' ) ?: 'image'; if ( 'image' === $global_breadcrumb_type ) { $global_breadcrumb_img = get_header_image(); if ( isset( $global_breadcrumb_img ) && ! empty( $global_breadcrumb_img ) ) { $style[] = 'background-image:url(\'' . esc_url( $global_breadcrumb_img ) . '\' )'; $has_bg_image = 'upstudy-breadcrumb-has-bg'; }; }elseif ( 'color' === $global_breadcrumb_type ) { $breadcrumb_color = Upstudy::setting( 'header_banner_overlay_color' ) ?: 'header_image'; if ( $breadcrumb_color ) { $style[] = 'background-color:' . esc_attr( $breadcrumb_color ); }; }; }; $title = upstudy_get_page_title(); $extra_style = ! empty( $style ) ? ' style="' . implode( "; ", $style ) . '"' : ""; upstudy_page_header_image_overlay($title, $has_bg_image, $extra_style); } endif; /** * Breadcrumb Shapes * */ if( ! function_exists( 'upstudy_breadcrumb_shapes' ) ) : function upstudy_breadcrumb_shapes() { $status = apply_filters( 'upstudy_breadcrumb_shape', true ); if ( $status ) : echo '
    '; echo '
    '; echo ''; echo 'Breadcrumb Abstract Shape'; echo ''; echo '
    '; echo '
    '; echo '
    '; echo '
    '; echo ''; echo 'Breadcrumb Abstract Shape'; echo ''; echo '
    '; echo '
    '; endif; } endif; /** * Breadcrumb Default Style */ if ( ! function_exists( 'upstudy_breadcrumb_default_style' ) ) : function upstudy_breadcrumb_default_style( $title = null, $has_bg_image = null, $extra_style = null ) { $header_title_tag = Upstudy::setting( 'header_title_tag' ) ?: 'h1'; $header_page_title_align = Upstudy::setting( 'header_page_title_align' ) ?: 'center'; $breadcrumb_show = Upstudy::setting( 'breadcrumb_show' ) ?: false; echo '
    '; echo '
    '; echo '
    '; echo '<'.$header_title_tag.' class="page-title has-text-align-'.$header_page_title_align.'">'; echo wp_kses_post( $title ); echo ''; echo '
    '; if ( $breadcrumb_show ) { echo '
    '; do_action( 'upstudy_breadcrumb' ); echo '
    '; } echo '
    '; upstudy_breadcrumb_shapes(); echo '
    '; } endif; /** * Breadcrumb Style 1 */ if ( ! function_exists( 'upstudy_breadcrumb_style_1' ) ) : function upstudy_breadcrumb_style_1( $title = null, $has_bg_image = null, $extra_style = null ) { $breadcrumb_show = Upstudy::setting( 'breadcrumb_show' ) ?: false; $header_title_tag = Upstudy::setting( 'header_title_tag' ) ?: 'h1'; $header_page_title_align = Upstudy::setting( 'header_page_title_align' ) ?: 'center'; echo '
    '; echo '
    '; echo '
    '; echo '<'.$header_title_tag.' class="page-title has-text-align-'.$header_page_title_align.'">'; echo wp_kses_post( $title ); echo ''; echo '
    '; if ($breadcrumb_show) { echo '
    '; do_action( 'upstudy_breadcrumb' ); echo '
    '; } echo '
    '; echo '
    '; } endif; /** * Breadcrumb Style 2 */ if ( ! function_exists( 'upstudy_breadcrumb_style_2' ) ) : function upstudy_breadcrumb_style_2( $title = null, $has_bg_image = null, $extra_style = null ) { $breadcrumb_show = Upstudy::setting( 'breadcrumb_show' ); echo '
    '; echo '
    '; if ( $breadcrumb_show ) { echo '
    '; do_action( 'upstudy_breadcrumb' ); echo '
    '; } echo '
    '; echo '
    '; } endif; /** * Setup breadcrumb */ add_action( 'upstudy_breadcrumb', 'upstudy_breadcrumb_setup', 10 ); if ( ! function_exists( 'upstudy_breadcrumb_setup' ) ) : function upstudy_breadcrumb_setup() { upstudy_breadcrumb_default(); } endif; /** * blog overlay breadcrumb */ if ( ! function_exists( 'upstudy_page_header_image_overlay' ) ) : function upstudy_page_header_image_overlay( $title = null, $has_bg_image = null, $extra_style = null ) { $blog_single_author_show = Upstudy::setting( 'blog_single_author_show' ) ?: false; $blog_single_date_show = Upstudy::setting( 'blog_single_date_show' ) ?: false; $blog_single_category_show = Upstudy::setting( 'blog_single_category_show' ) ?: false; $blog_single_comment_show = Upstudy::setting( 'blog_single_comment_show' ) ?: false; $blog_comments_text = Upstudy::setting( 'blog_comments_text' ) ?: false; $blog_single_img_overlay_shape = Upstudy::setting( 'blog_single_img_overlay_shape' ) ?: false; // $breadcrumb_show = Upstudy::setting( 'breadcrumb_show' ) ?: false; $align_class = is_rtl() ? ('has-text-align-right') : ('has-text-align-left'); $shape_enable_class = $blog_single_img_overlay_shape ? 'upstudy-default-breadcrumb' : ''; echo '
    '; if($blog_single_img_overlay_shape){ upstudy_breadcrumb_shapes(); } echo '
    '; echo '
    '; if($blog_single_category_show){ echo '
    '; echo '' . wp_kses_post( upstudy_category_by_id( get_the_ID(), 'category' ) ) . ''; echo '
    '; } echo '

    '; echo wp_kses_post( $title ); echo '

    '; echo '
    '; echo '
    '; echo ''; if (Upstudy::setting( 'blog_single_like_show' )) { if ( function_exists( 'upstudy_render_like_button' ) ) { upstudy_render_like_button(); } } echo '
    '; // if ($breadcrumb_show) { // echo '
    '; // do_action( 'upstudy_breadcrumb' ); // echo '
    '; // } echo '
    '; echo '
    '; } endif; /** * page title */ if ( ! function_exists( 'upstudy_get_page_title' ) ) : function upstudy_get_page_title() { global $post; $title = get_the_title(); $blog_single_layout = Upstudy::setting( 'blog_single_layout' ); $blog_single_page_title_text = Upstudy::setting( 'blog_single_page_title_text' ); if ( is_home() ) : $title = apply_filters( 'upstudy_blog_page_title', __( 'Blog', 'upstudy' ) ); elseif ( is_singular( 'post' ) ) : if (($blog_single_layout == 'blog_layout_title_first' || $blog_single_layout == 'blog_layout_image_first') && $blog_single_page_title_text == 'post-type-name') $title = __('Blog Post', 'upstudy'); else { $title = get_the_title(); } elseif (is_post_type_archive( 'product' ) ) : $wp_archive_page_title = Upstudy::setting( 'wp_archive_page_title' ); $title = $wp_archive_page_title ? $wp_archive_page_title : $title; elseif ( is_archive() ) : $title = get_the_archive_title(); if ( is_post_type_archive( 'lp_course' ) ) : $lp_course_archive_page_title = Upstudy::setting( 'lp_archive_page_title' ); $title = $lp_course_archive_page_title ? $lp_course_archive_page_title : $title; endif; if ( is_post_type_archive( 'sfwd-courses' ) ) : $ld_course_archive_page_title = Upstudy::setting( 'ld_archive_page_title' ); $title = $ld_course_archive_page_title ? $ld_course_archive_page_title : $title; endif; if ( is_post_type_archive( 'courses' ) ) : $tutor_course_archive_page_title = Upstudy::setting( 'tutor_archive_page_title' ); $title = $tutor_course_archive_page_title ? $tutor_course_archive_page_title : $title; endif; if ( is_post_type_archive( 'course' ) ) : $sensei_course_archive_page_title = Upstudy::setting( 'sensei_archive_page_title' ); $title = $sensei_course_archive_page_title ? $sensei_course_archive_page_title : $title; endif; if ( is_post_type_archive( 'zoom-meetings' ) ) : $zoom_archive_page_title = Upstudy::setting( 'zoom_archive_page_title' ); $title = $zoom_archive_page_title ? $zoom_archive_page_title : $title; endif; if ( is_post_type_archive( 'tp_event' ) ) : $tp_event_archive_page_title = Upstudy::setting( 'tp_event_archive_page_title' ); $title = $tp_event_archive_page_title ? $tp_event_archive_page_title : $title; endif; if ( is_post_type_archive( 'tp_event' ) ) : $tp_event_archive_page_title = Upstudy::setting( 'tp_event_archive_page_title' ); $title = $tp_event_archive_page_title ? $tp_event_archive_page_title : $title; endif; if ( is_post_type_archive( 'tribe_events' ) ) : $tribe_event_archive_page_title = Upstudy::setting( 'tribe_events_archive_page_title' ); $title = $tribe_event_archive_page_title ? $tribe_event_archive_page_title : $title; endif; elseif ( is_day() ) : $title = get_the_time( get_option( 'date_format' ) ); elseif ( is_month() ) : $title = get_the_time( 'F Y' ); elseif ( is_year() ) : $title = get_the_time( 'Y' ); elseif ( ! is_single() && ! is_page() && get_post_type() != 'post' && ! is_404() && ! is_author() && ! is_search() ) : $post_type = get_post_type_object( get_post_type() ); if ( is_object( $post_type ) ) : $title = $post_type->labels->singular_name; endif; elseif ( is_attachment() ) : $title = get_the_title(); elseif ( is_page() && ! $post->post_parent ) : $title = get_the_title(); $page_custom_title = get_post_meta( $post->ID, '_upstudy_custom_page_title', true ); $title = $page_custom_title ? $page_custom_title : $title; elseif ( is_page() && $post->post_parent ) : $title = get_the_title(); $page_custom_title = get_post_meta( $post->ID, '_upstudy_custom_page_title', true ); $title = $page_custom_title ? $page_custom_title : $title; elseif ( is_search() ) : if ( upstudy_is_search_has_results() ) : $title = sprintf( __( 'Search results for: %s', 'upstudy' ), '' . esc_html( get_search_query() ) . '' ); else : $title = __( 'Nothing Found', 'upstudy' ); endif; elseif ( is_tag() ) : $title = __( 'Posts tagged "', 'upstudy' ). single_tag_title( '', false ) . '"'; elseif ( is_author() ) : global $author; $userdata = get_userdata( $author ); $title = $userdata->display_name; elseif ( is_404() ) : $title = __( '404: Error Not Found', 'upstudy' ); elseif ( is_singular( 'lp_course' ) ) : $title = get_the_title(); elseif ( ( function_exists( 'upstudy_is_lp_courses' ) && upstudy_is_lp_courses() ) ) : $title = esc_html( get_the_title( learn_press_get_page_id( 'courses' ) ) ); endif; return $title; } endif; /** * Setup breadcrumb */ if ( ! function_exists( 'upstudy_breadcrumb_default' ) ) : function upstudy_breadcrumb_default( $spacer = ' ', $word = '' ) { $main_home = __( 'Home', 'upstudy' ); $before = '
  • '; $after = '
  • '; if ( ! is_front_page() || is_paged() ) : global $post; $homeURL = esc_url( home_url() ); echo ''; endif; } endif; /** * Login registration popup form */ if( ! function_exists( 'upstudy_login_register_form_popup' ) ) : function upstudy_login_register_form_popup() { if( is_user_logged_in() || ( ! Upstudy::setting( 'login_popup_active' ) ) || ( ! Upstudy::setting( 'login_reg_show' ) ) ) return; echo '
    '; echo '
    '; echo ''; echo ''; echo '
    '; echo '
    '; echo '
    '; } endif; /** * Upstudy Footer Content */ if ( ! function_exists( 'upstudy_footer_content_init' ) ) : function upstudy_footer_content_init() { // search modal popup $search_type = Upstudy::setting( 'upstudy_search_style' ); $top_search_enable = Upstudy::setting( 'top_search_enable' ); if ($top_search_enable) { if ($search_type == 'tpc_tutor_search') { upstudy_lms_course_search_modal_popup(); } elseif ($search_type == 'tpc_lp_search') { upstudy_lms_course_search_modal_popup(); } elseif ($search_type == 'tpc_ld_search') { upstudy_lms_course_search_modal_popup(); } else { upstudy_whole_search_modal_popup(); } } // scroll to top $back_to_top_show = Upstudy::setting( 'back_to_top_show' ) ?: false; if ( $back_to_top_show ) : echo '
    '; echo ''; echo ''; echo ''; echo '
    '; endif; // login register form popup if ( Upstudy::setting( 'login_popup_active' ) && Upstudy::setting( 'login_reg_show' ) ) : upstudy_login_register_form_popup(); endif; } endif; add_action( 'wp_footer', 'upstudy_footer_content_init' ); /** * is Search has result */ if ( ! function_exists( 'upstudy_is_search_has_results' ) ) : function upstudy_is_search_has_results() { return 0 != $GLOBALS['wp_query']->found_posts; } endif; /** * Register Google fonts. * * @return string Google fonts URL for the theme. */ if ( ! function_exists( 'upstudy_main_fonts_url' ) ) : function upstudy_main_fonts_url() { $body_typo_array = Upstudy::setting( 'upstudy_body_text_font' ); $heading_typo_array = Upstudy::setting( 'upstudy_heading_font' ); $body_font_family = 'Open Sans'; $heading_font_family = 'Outfit'; if ( isset( $body_typo_array['font-family'] ) && ! empty( $body_typo_array['font-family'] ) ) : $body_font_family = $body_typo_array['font-family']; endif; if ( isset( $heading_typo_array['font-family'] ) && ! empty( $heading_typo_array['font-family'] ) ) : $heading_font_family = $heading_typo_array['font-family']; endif; $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; if ( 'off' !== esc_html_x( 'on', $body_font_family . ' font: on or off', 'upstudy' ) ) : $fonts[] = $body_font_family . ':300,400,500,600,700,800'; endif; if ( 'off' !== esc_html_x( 'on', $heading_font_family . ' font: on or off', 'upstudy' ) ) : $fonts[] = $heading_font_family . ':300,400,500,600,700,800'; endif; if ( $fonts ) : $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), 'https://fonts.googleapis.com/css' ); endif; return esc_url_raw( $fonts_url ); } endif; // Enqueue Google Fonts styles add_action( 'wp_enqueue_scripts', 'upstudy_google_fonts_adding' ); if ( ! function_exists( 'upstudy_google_fonts_adding' ) ) : function upstudy_google_fonts_adding() { wp_enqueue_style( 'upstudy-main-fonts', upstudy_main_fonts_url(), array(), UPSTUDY_THEME_VERSION ); } endif; /** * Excerpt more * @since 1.0.0 */ if ( ! function_exists( 'upstudy_excerpt_more' ) ) : function upstudy_excerpt_more( $more ) { return '…'; } endif; add_filter( 'excerpt_more', 'upstudy_excerpt_more' ); /** * Upstudy Post Archive Support For Theme Option * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_has_archive_theme_option_support' ) ) : function upstudy_has_archive_theme_option_support () { $supported = [ 'lp_course', 'product' ]; return $supported; } endif; /** * is Blog * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_is_blog' ) ) : function upstudy_is_blog () { if ( is_home() || is_archive() || is_author() || is_category() || is_tag() || is_search() ) { return true; } if ( is_single() ) { $post = get_queried_object(); if ( $post instanceof WP_Post ) { if ( $post->post_type === 'post' ) { return true; } } } return false; } endif; /** * Page Layout setup * * @since 1.0.0 */ add_filter( 'upstudy_container_class', 'upstudy_page_layout_setup' ); if ( ! function_exists( 'upstudy_page_layout_setup' ) ) : function upstudy_page_layout_setup( $class ) { if ( is_page() ) : $page_layout = get_post_meta( get_the_ID(), '_upstudy_page_container', true ); if ( 'full-width' === $page_layout ) : $class = ' upstudy-fullwidth-page-container'; else : $class = ' upstudy-page-container upstudy-container'; endif; endif; if ( is_singular( 'elementor_library' ) ) : $class = ' upstudy-elementor-fullwidth-page-container'; endif; return $class; } endif; /** * Before Content * * @since 1.0.0 */ add_action( 'upstudy_before_content', 'upstudy_before_main_content' ); if ( ! function_exists( 'upstudy_before_main_content' ) ) : function upstudy_before_main_content(){ $layout_type = ''; if ( true === upstudy_is_blog() ) : $layout_type = ' upstudy-row'; endif; if ( is_post_type_archive( 'zoom-meetings' ) ) : $layout_type = ' upstudy-blog-post-archive-style-1 upstudy-row'; endif; if ( is_page() ) : $page_layout = get_post_meta( get_the_ID(), '_upstudy_page_container', true ); if ( 'full-width' === $page_layout ) : $layout_type = ' upstudy-fullwidth-page-row'; else : $layout_type = ' upstudy-row'; endif; endif; if ( is_404() ) : $layout_type = ' upstudy-row upstudy-justify-content-center'; endif; if ( is_search() ) : $layout_type = ' upstudy-row'; endif; if ( is_singular( 'elementor_library' ) ) : $layout_type = ''; endif; if ( is_post_type_archive( 'product' ) || is_post_type_archive( 'tp_event' ) || is_post_type_archive( 'tribe_events' ) || is_tax( 'tp_event_category' ) || is_tax( 'tp_event_tag' ) ) : $layout_type = ''; endif; if ( function_exists( 'tml_get_action' ) ) : if ( tml_get_action() ) : $layout_type = ' upstudy-row upstudy-justify-content-center'; endif; endif; echo '
    '; } endif; /** * After Content * * @since 1.0.0 */ add_action( 'upstudy_after_content', 'upstudy_after_main_content' ); if ( ! function_exists( 'upstudy_after_main_content' ) ) : function upstudy_after_main_content(){ echo '
    '; } endif; /** * Content area class * * @since 1.0.0 */ add_filter( 'upstudy_content_area_class', 'upstudy_content_wrapper_class' ); if ( ! function_exists( 'upstudy_content_wrapper_class' ) ) : function upstudy_content_wrapper_class ( $class ) { if ( upstudy_is_blog() ) : $blog_layout = Upstudy::setting( 'blog_sidebar' ); $blog_sidebar = Upstudy::setting( 'blog_archive_sidebar_name' ); $blog_sidebar_width = Upstudy::setting( 'blog_sidebar_width' ); $blog_clm = ($blog_sidebar_width == '4') ? '8' : '9' ; if ( isset( $_GET['sidebar_disable'] ) ) : $blog_sidebar = 'no-sidebar'; endif; if ( ! is_active_sidebar( $blog_sidebar ) ) : $class = 'upstudy-col-lg-12'; elseif ( 'right-sidebar' === $blog_layout ) : $class = 'upstudy-col-lg-' .$blog_clm. ''; elseif ( 'left-sidebar' === $blog_layout ) : $class = 'upstudy-col-lg-' .$blog_clm. ' upstudy-order-2'; elseif ( 'no-sidebar' === $blog_layout ) : $class = 'upstudy-col-lg-12'; endif; endif; if ( is_single() ) : $single_layout = Upstudy::setting( 'blog_single_sidebar' ); $single_sidebar = Upstudy::setting( 'blog_single_sidebar_name' ); $blog_single_sidebar_width = Upstudy::setting( 'blog_single_sidebar_width' ); $blog_single_clm = ($blog_single_sidebar_width == '4') ? '8' : '9' ; if ( ! is_active_sidebar( $single_sidebar ) ) : $class = 'upstudy-col-lg-12'; elseif ( 'right-sidebar' === $single_layout ) : $class = 'upstudy-col-lg-'. $blog_single_clm .''; elseif ( 'left-sidebar' === $single_layout ) : $class = 'upstudy-col-lg-'. $blog_single_clm .' upstudy-order-2'; elseif ( 'no-sidebar' === $single_layout ) : $class = 'upstudy-col-lg-12'; endif; endif; // if ( is_single() && 'simple_team' === get_post_type() ) : // $class = 'upstudy-col-lg-12'; // endif; if ( is_page() ) : $content_type = get_post_meta( get_the_ID(), '_upstudy_page_content_layout', true ); $page_layout = get_post_meta( get_the_ID(), '_upstudy_page_container', true ); $page_sidebar = get_post_meta( get_the_ID(), '_upstudy_page_sidebar_id', true ); $upstudy_page_sidebar_width = get_post_meta( get_the_ID(), '_upstudy_page_sidebar_width', true ); $page_clm = ( $upstudy_page_sidebar_width == '4') ? '8' : '9' ; if ( isset( $page_layout ) && ! empty( $page_layout ) ) : if ( 'full-width' === $page_layout ) : $class = 'upstudy-col-lg-12'; else : if ( ! is_active_sidebar( $page_sidebar ) ) : $class = 'upstudy-col-lg-12'; elseif ( 'right-sidebar' === $content_type ) : $class = 'upstudy-col-lg-'. $page_clm .''; elseif ( 'left-sidebar' === $content_type ) : $class = 'upstudy-col-lg-'. $page_clm .' upstudy-order-2'; elseif ( 'no-sidebar' === $content_type ) : $class = 'upstudy-col-lg-12'; endif; endif; else : $class = 'upstudy-col-lg-12'; endif; endif; return $class; } endif; /** * Widget area class */ add_filter( 'upstudy_get_widget_class', 'upstudy_widget_wrapper_class' ); if ( ! function_exists( 'upstudy_widget_wrapper_class' ) ) : function upstudy_widget_wrapper_class ( $class ) { if ( upstudy_is_blog() ) : $blog_layout = Upstudy::setting( 'blog_sidebar' ); $blog_sidebar_width = Upstudy::setting( 'blog_sidebar_width' ); $blog_clm = ($blog_sidebar_width == '4') ? '4' : '3' ; if ( 'right-sidebar' === $blog_layout ) : $class = 'upstudy-col-lg-' .$blog_clm .''; elseif ( 'left-sidebar' === $blog_layout ) : $class = 'upstudy-col-lg-' .$blog_clm .' upstudy-order-1'; elseif ( 'no-sidebar' === $blog_layout ) : $class = ''; endif; endif; if ( is_single() ) : $single_layout = Upstudy::setting( 'blog_single_sidebar' ); $blog_single_sidebar_width = Upstudy::setting( 'blog_single_sidebar_width' ); $blog_single_clm = ($blog_single_sidebar_width == '4') ? '4' : '3' ; if ( 'right-sidebar' === $single_layout ) : $class = 'upstudy-col-lg-'. $blog_single_clm .''; elseif ( 'left-sidebar' === $single_layout ) : $class = 'upstudy-col-lg-'. $blog_single_clm .' upstudy-order-1'; elseif ( 'no-sidebar' === $single_layout ) : $class = ''; endif; endif; if ( is_page() ) : $content_type = get_post_meta( get_the_ID(), '_upstudy_page_content_layout', true ); $upstudy_page_sidebar_width = get_post_meta( get_the_ID(), '_upstudy_page_sidebar_width', true ); $page_sidebar_width = ( $upstudy_page_sidebar_width == '4') ? '4' : '3' ; if ( 'right-sidebar' === $content_type ) : $class = 'upstudy-col-lg-'. $page_sidebar_width .''; elseif ( 'left-sidebar' === $content_type ) : $class = 'upstudy-col-lg-'. $page_sidebar_width .' upstudy-order-1'; elseif ( 'no-sidebar' === $content_type ) : $class = ''; endif; endif; return $class; } endif; /** * Widget sticky class */ add_filter( 'upstudy_get_widget_sticky_class', 'upstudy_widget_sticky_class' ); if ( ! function_exists( 'upstudy_widget_sticky_class' ) ) : function upstudy_widget_sticky_class ( $class ) { if ( upstudy_is_blog() ) : $blog_layout = Upstudy::setting( 'blog_sidebar' ); $blog_sidebar_sticky = Upstudy::setting( 'blog_sidebar_sticky' ); $do_blog_sticky = ($blog_sidebar_sticky ) ? 'do_sticky' : '' ; if ( 'right-sidebar' === $blog_layout ) : $class = $do_blog_sticky; elseif ( 'left-sidebar' === $blog_layout ) : $class = $do_blog_sticky; elseif ( 'no-sidebar' === '' ) : $class = ''; endif; endif; if ( is_single() ) : $single_layout = Upstudy::setting( 'blog_single_sidebar' ); $blog_single_sidebar_sticky = Upstudy::setting( 'blog_single_sidebar_sticky' ); $do_blog_single_sticky = ($blog_single_sidebar_sticky ) ? 'do_sticky' : '' ; if ( 'right-sidebar' === $single_layout ) : $class = $do_blog_single_sticky; elseif ( 'left-sidebar' === $single_layout ) : $class = $do_blog_single_sticky; elseif ( 'no-sidebar' === $single_layout ) : $class = ''; endif; endif; if ( is_page() ) : $content_type = get_post_meta( get_the_ID(), '_upstudy_page_content_layout', true ); $upstudy_page_sidebar_sticky = get_post_meta( get_the_ID(), '_upstudy_page_sidebar_sticky', true ); $do_page_sticky = ( $upstudy_page_sidebar_sticky == 'enable') ? 'do_sticky' : '' ; if ( 'right-sidebar' === $content_type ) : $class = $do_page_sticky; elseif ( 'left-sidebar' === $content_type ) : $class = $do_page_sticky; elseif ( 'no-sidebar' === $content_type ) : $class = ''; endif; endif; return $class; } endif; /** * Sidebar Name */ add_filter( 'upstudy_get_sidebar', 'upstudy_sidebar_name' ); if ( ! function_exists( 'upstudy_sidebar_name' ) ) : function upstudy_sidebar_name ( $sidebar_layout ) { if ( upstudy_is_blog() ) : $sidebar_layout = Upstudy::setting( 'blog_archive_sidebar_name' ); endif; if ( is_single() ) : $sidebar_layout = Upstudy::setting( 'blog_single_sidebar_name' ); endif; if ( is_page() ) : $sidebar_layout = get_post_meta( get_the_ID(), '_upstudy_page_sidebar_id', true ); endif; return $sidebar_layout; } endif; /** * page footer wrapper class * action located at content-page.php * * @since 1.0.0 */ add_action( 'upstudy_page_footer_wrapper_class', 'upstudy_page_footer_wrapper_class_setup' ); if ( ! function_exists( 'upstudy_page_footer_wrapper_class_setup' ) ) : function upstudy_page_footer_wrapper_class_setup(){ $class = ''; if ( is_page() ) : $content_type = 'boxed'; if ( $content_type && $content_type == 'boxed' ) : $class = ''; else : $class = ' upstudy-container'; endif; endif; echo esc_attr( $class ); } endif; /** * Author bio * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_author_bio' ) ) : function upstudy_author_bio() { $description = get_the_author_meta( 'description' ); $user_url = get_the_author_meta( 'user_url' ); if ( ! empty( $description ) ) : echo '
    '; echo ''; echo '
    '; echo '
    ' . esc_html( get_the_author() ) . '
    '; echo '
    '; echo wpautop( wp_kses_post( $description ) ); echo '
    '; echo '
    '; upstudy_user_social_icons( get_the_author_meta( 'ID' ) ); echo '
    '; echo '
    '; echo '
    '; endif; } endif; /** * Link Pages Bootstrap * @author toscha * @link http://wordpress.stackexchange.com/questions/14406/how-to-style-current-page-number-wp-link-pages * @param array $args * @return void * Modification of wp_link_pages() with an extra element to highlight the current page. */ if ( ! function_exists( 'upstudy_link_pages' ) ): function upstudy_link_pages( $args = array () ) { $defaults = array( 'before' => '', 'before_link' => '
  • ', 'after_link' => '
  • ', 'current_before' => '
  • ', 'current_after' => '
  • ', 'link_before' => '', 'link_after' => '', 'pagelink' => '%', 'echo' => 1 ); $r = wp_parse_args( $args, $defaults ); $r = apply_filters( 'wp_link_pages_args', $r ); extract( $r, EXTR_SKIP ); global $page, $numpages, $multipage, $more, $pagenow; if ( ! $multipage ) : return; endif; $output = $before; for ( $i = 1; $i < ( $numpages + 1 ); $i++ ) : $j = str_replace( '%', $i, $pagelink ); $output .= ' '; if ( $i != $page || ( ! $more && 1 == $page ) ) : $output .= "{$before_link}" . _wp_link_page( $i ) . "{$link_before}{$j}{$link_after}{$after_link}"; else : $output .= "{$current_before}{$link_before}{$j}{$link_after}{$current_after}"; endif; endfor; print wp_kses_post( $output ) . wp_kses_post( $after ); } endif; /** * WordPress Bootstrap pagination * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_numeric_pagination' ) ) : function upstudy_numeric_pagination( $args = array() ) { $defaults = array( 'range' => 4, 'custom_query' => FALSE, 'previous_string' => '', 'next_string' => '', 'before_output' => '' ); $args = wp_parse_args( $args, apply_filters( 'wp_bootstrap_pagination_defaults', $defaults ) ); $args['range'] = (int) $args['range'] - 1; if ( !$args['custom_query'] ) $args['custom_query'] = $GLOBALS['wp_query']; $count = (int) $args['custom_query']->max_num_pages; $page = intval( get_query_var( 'paged' ) ); $ceil = ceil( $args['range'] / 2 ); if ( $count <= 1 ) return FALSE; if ( !$page ) $page = 1; if ( $count > $args['range'] ) : if ( $page <= $args['range'] ) : $min = 1; $max = $args['range'] + 1; elseif ( $page >= ($count - $ceil) ) : $min = $count - $args['range']; $max = $count; elseif ( $page >= $args['range'] && $page < ($count - $ceil) ) : $min = $page - $ceil; $max = $page + $ceil; endif; else : $min = 1; $max = $count; endif; $echo = ''; $previous = intval($page) - 1; $previous = esc_attr( get_pagenum_link($previous) ); if ( $previous && (1 != $page) ) $echo .= sprintf ( '
  • %s
  • ', esc_url( $previous ), __( 'previous', 'upstudy' ), $args['previous_string'] ); if ( ! empty( $min ) && ! empty( $max ) ) : for( $i = $min; $i <= $max; $i++ ) : if ( $page == $i ) : $echo .= sprintf ( '
  • %s
  • ', esc_html( (int)$i ) ); else : $echo .= sprintf( '
  • %2d
  • ', esc_attr( get_pagenum_link($i) ), $i ); endif; endfor; endif; $next = intval($page) + 1; $next = esc_attr( get_pagenum_link( $next ) ); if ($next && ($count != $page) ) $echo .= sprintf ( '
  • %s
  • ', esc_url( $next ), __( 'next', 'upstudy' ), $args['next_string'] ); if ( isset($echo) ) echo wp_kses_post( $args['before_output'] ) . $echo . wp_kses_post( $args['after_output'] ); } endif; /** * Pagination RTL support * * @since 1.0.0 */ add_filter( 'wp_bootstrap_pagination_defaults', 'upstudy_pagination_rtl_support' ); if ( ! function_exists( 'upstudy_pagination_rtl_support' ) ) : function upstudy_pagination_rtl_support($args) { if ( is_rtl() ) : $args['next_string'] = ''; $args['previous_string'] = ''; endif; return $args; } endif; /** * Comment list walker * A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list. * @package WP Bootstrap Comment Walker * @version 1.0.0 * @author Edi Amin * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later * @link https://github.com/ediamin/wp-bootstrap-comment-walker */ if ( ! class_exists( 'Upstudy_Comment_Walker' ) ) : class Upstudy_Comment_Walker extends Walker_Comment { /** * Output a comment in the HTML5 format. * * @access protected * @since 1.0.0 * * @see wp_list_comments() * * @param object $comment Comment to display. * @param int $depth Depth of comment. * @param array $args An array of arguments. */ protected function html5_comment( $comment, $depth, $args ) { $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; $commenter = wp_get_current_commenter(); if ( $commenter['comment_author_email'] ) : $moderation_note = __( 'Your comment is awaiting moderation.', 'upstudy' ); else : $moderation_note = __( 'Your comment is awaiting moderation. This is a preview, your comment will be visible after it has been approved.', 'upstudy' ); endif; ?> < id="comment-" has_children ? 'parent upstudy-media upstudy-comment-item' : 'upstudy-media upstudy-comment-item' ); ?>>
    comment_approved ) : ?>

    $depth, 'max_depth' => $args['max_depth'], 'reply_text' => sprintf( '%s', __( 'Reply', 'upstudy' ) ) ), $comment->comment_ID, $comment->comment_post_ID ); ?>
    'upstudy-comment-form form media-body', 'class_submit' => 'upstudy-comment-btn', 'title_reply_before' => '

    ', 'title_reply' => __( 'Leave a Reply', 'upstudy' ), 'label_submit' => __( 'Post A Comment', 'upstudy' ), 'title_reply_after' => '

    ', 'must_log_in' => '', 'fields' => apply_filters( 'comment_form_default_fields', array( 'author' => '
    ', 'email' => '
    ', 'url' => '
    ', ) ), 'comment_field' => '
    ' ); return $args; } endif; /** * Custom form * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_hidden_comment_form' ) ) : function upstudy_hidden_comment_form( $arg ) { global $post; if ( 'open' == $post->comment_status ) : ob_start(); comment_form( $arg ); $form = ob_get_clean(); echo '
    '; echo str_replace( 'id="commentform"', 'id="commentform" enctype="multipart/form-data"', $form ); echo '
    '; endif; } endif; /** * Move Comment Field & Cookie Consent to Bottom * * @since 1.0.0 */ function upstudy_move_comment_field_to_bottom( $fields ) { $comment_field = $fields['comment']; if ( isset( $fields['cookies'] ) ) : $cookies_field = $fields['cookies']; endif; unset( $fields['comment'] ); if ( isset( $fields['cookies'] ) ) : unset( $fields['cookies'] ); endif; $fields['comment'] = $comment_field; if ( isset( $fields['cookies'] ) ) : $fields['cookies'] = $cookies_field; endif; return $fields; } add_filter( 'comment_form_fields', 'upstudy_move_comment_field_to_bottom' ); /** * Body Classes * * @since 1.0.0 */ add_filter( 'body_class', 'upstudy_get_body_classes' ); if ( ! function_exists( 'upstudy_get_body_classes' ) ) : function upstudy_get_body_classes( $classes ) { global $post; $upstudy_transparent_header = Upstudy::setting( 'upstudy_transparent_header' ) ?: false; $upstudy_sticky_type = Upstudy::setting( 'upstudy_sticky_type' ); if( $upstudy_sticky_type == 'always' ) : $classes[] = 'upstudy-always-sticky'; else: $classes[] = 'upstudy-smart-sticky'; endif; if( $upstudy_transparent_header ) : $classes[] = 'upstudy-header-transparent-enable'; endif; if ( isset( $post ) && $post instanceof WP_Post ) { $header_transparent = get_post_meta( $post->ID, '_upstudy_page_header_transparent', true ); if ( $header_transparent === 'enable' ) { $classes[] = 'upstudy-header-transparent-enable'; } else { $classes[] = 'upstudy-header-transparent-disable'; } } if ( is_page() && is_object( $post ) ) : $classes[] = 'upstudy-page-content'; $page_layout = get_post_meta( get_the_ID(), '_upstudy_page_container', true ); $content_type = get_post_meta( get_the_ID(), '_upstudy_page_content_layout', true ); $breadcrumb_visibility = get_post_meta( get_the_ID(), '_upstudy_page_header_enable', true ); $breadcrumb_show_framework = Upstudy::setting( 'page_header_show' ); if( get_post_meta( $post->ID, '_upstudy_page_header_transparent', true ) && get_post_meta( $post->ID, '_upstudy_page_header_transparent', true ) == 'enable' ) : $classes[] = 'upstudy-header-transparent-enable'; endif; if ( ! is_front_page() ) : if ( 'disable' !== $breadcrumb_visibility ) : if ( ( 'enable' === $breadcrumb_visibility ) || ( isset( $breadcrumb_show_framework ) && ! empty( $breadcrumb_show_framework ) ) ) : $classes[] = 'upstudy-page-breadcrumb-enable'; else : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; else : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; else : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; if ( 'full-width' === $page_layout ) : $classes[] = 'upstudy-page-fullwidth'; else : $classes[] = 'upstudy-page-boxed'; endif; if ( isset( $content_type ) && ! empty( $content_type ) ) : if ( 'no-sidebar' === $content_type ) : $classes[] = 'upstudy-page-sidebar-disable'; else : $classes[] = 'upstudy-page-sidebar-enable'; endif; else : $classes[] = 'upstudy-page-sidebar-disable'; endif; $extra_class = get_post_meta( $post->ID, 'upstudy_page_extra_class', true ); if ( ! empty( $extra_class ) ) : $classes[] = trim( $extra_class ); endif; elseif ( is_singular() || is_category() || is_tax() || is_home() || is_search() || upstudy_is_blog() ) : $show = true; if ( ! $show ) : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; elseif ( is_singular( 'tp_event' ) || is_post_type_archive( 'tp_event' ) || is_tax( 'tp_event_category' ) || is_tax( 'tp_event_tags' ) ) : $show = true; if ( ! $show ) : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; elseif ( class_exists( 'WooCommerce' ) && is_woocommerce() ) : $show = Upstudy::setting( 'show_shop_breadcrumb' ); if ( ! $show ) : $classes[] = 'upstudy-page-breadcrumb-disable'; endif; endif; if ( is_single() ) : $blog_single_layout = Upstudy::setting( 'blog_single_layout' ); if ( $blog_single_layout ) : $classes[] = $blog_single_layout; endif; endif; return $classes; } endif; /** * Header Extra Class * * @since 1.0.0 */ if ( ! function_exists( 'upstudy_header_classes' ) ) : function upstudy_header_classes( $classes ) { global $post; if ( is_page() && is_object( $post ) ) : $header_color_white = get_post_meta( get_the_ID(), '_upstudy_page_transparent_header_color', true ); $header_transparent = get_post_meta( get_the_ID(), '_upstudy_page_header_transparent', true ); $header_white_logo_status = get_post_meta( get_the_ID(), '_upstudy_page_transparent_logo', true ); $header_sticky = get_post_meta( get_the_ID(), '_upstudy_page_header_sticky', true ); $page_dark_header = get_post_meta( get_the_ID(), '_upstudy_page_dark_header', true ); // $extra_class = get_post_meta( $post->ID, 'upstudy_page_extra_class', true ); $white_logo = Upstudy::setting( 'header_white_logo' ); if ( 'enable' === $header_color_white ) : $classes[] = 'header-color-white'; endif; if ( 'enable' === $header_transparent && 'enable' === $header_white_logo_status && isset( $white_logo ) && ! empty( $white_logo ) ) : $classes[] = 'white-logo-enable'; endif; if ( 'enable' === $header_sticky && ! in_array( 'header-get-sticky', $classes ) ) : $classes[] = 'header-get-sticky'; endif; if ( 'enable' === $page_dark_header ) : $classes[] = 'upstudy-dark-header'; endif; // if ( ! empty( $extra_class ) ) : // $classes[] = trim( $extra_class ); // endif; endif; return $classes; } endif; add_filter( 'upstudy_header_class_array', 'upstudy_header_classes' ); /** * Theme Name at Body Classes * * @since 1.0.0 */ add_filter( 'body_class', 'upstudy_get_theme_name_in_body_classes' ); if ( ! function_exists( 'upstudy_get_theme_name_in_body_classes' ) ) : function upstudy_get_theme_name_in_body_classes( $classes ) { $classes[] = 'theme-name-' . esc_attr( wp_get_theme()->get( 'TextDomain' ) ); return $classes; } endif; /** * Upstudy Supported LMS Builders * * @return boolean */ function upstudy_is_lms_courses() { if ( ( function_exists( 'upstudy_is_lp_courses' ) && upstudy_is_lp_courses() ) || is_singular( 'lp_course' ) || is_post_type_archive( 'lp_course' ) || is_tax( 'course_category' ) || is_tax( 'course_tag' ) ) : return true; elseif ( is_singular( 'courses' ) || is_post_type_archive( 'courses' ) || is_tax( 'course-category' ) || is_tax( 'course-tag' ) ) : return true; elseif ( is_singular( 'sfwd-courses' ) || is_post_type_archive( 'sfwd-courses' ) || is_tax( 'ld_course_category' ) || is_tax( 'ld_course_tag' ) ) : return true; endif; return false; } /** * Upstudy Supported LMS Builders Course Details Page * * @return boolean */ function upstudy_is_lms_course_details() { if ( is_singular( 'lp_course' ) ) : // LearnPress return true; elseif ( is_singular( 'courses' ) ) : // Tutor LMS return true; elseif ( is_singular( 'course' ) ) : // Lifter Lms & Sensei LMS return true; elseif ( is_singular( 'stm-courses' ) ) : // Masterstudy return true; elseif ( is_singular( 'sfwd-courses' ) ) : // LearnDash return true; endif; return false; } /** * Single Post Support With Header & Footer Blank * return array of post_types * @since 1.0.0 */ if ( ! function_exists( 'upstudy_header_footer_blank_single_post_array' ) ) : function upstudy_header_footer_blank_single_post_array() { $supported_array = apply_filters( 'upstudy_header_footer_blank_post_array', [ 'eb_header', 'eb_footer', 'upstudy_megamenu', 'elementor_library' ] ); return $supported_array; } endif; /** * Estimated Reading Time * * @return void */ if( ! function_exists( 'upstudy_post_estimated_reading_time' ) ) : function upstudy_post_estimated_reading_time( $with_second = false ) { global $post; $words_per_min = apply_filters( 'upstudy_words_read_per_min', 200 ); // get the content $the_content = $post->post_content; // count the number of words $words = str_word_count( strip_tags( $the_content ) ); // rounding off and deviding per 200( $words_per_min ) words per minute $minute = floor( $words / $words_per_min ); // rounding off to get the seconds $second = floor( $words % $words_per_min / ( $words_per_min / 60 ) ); // calculate the amount of time needed to read $estimate = $minute . ' ' . __( 'Min', 'upstudy' ) . ( $minute == 1 ? '' : __( 's', 'upstudy' ) ); if ( $minute < 1 ) : $estimate = $second . ' ' . __( 'Sec', 'upstudy' ) . ( $second == 1 ? '' : __( 's', 'upstudy' ) ); endif; if ( $with_second ) : $estimate = $minute . ' ' . __( 'Min', 'upstudy' ) . ( $minute == 1 ? '' : __( 's', 'upstudy' ) ) . ', ' . $second . ' ' . __( 'Sec', 'upstudy' ) . ( $second == 1 ? '' : __( 's', 'upstudy' ) ); endif; return $estimate; } endif; /** * return all the thumb sizes * * @return void */ function upstudy_get_thumbnail_sizes() { $image_sizes = get_intermediate_image_sizes(); $additional_sizes = array( __( 'Full size', 'upstudy' ) => 'full' ); $newsizes = array_merge( $image_sizes, $additional_sizes ); return apply_filters( 'upstudy_thumb_size_filter', array_combine( $newsizes, $newsizes ) ); } /** * add title after image at zoom details page */ // Left Section Single Content( with heading ) add_action( 'vczoom_single_content_left', 'upstudy_video_conference_zoom_heading', 15 ); if( ! function_exists( 'upstudy_video_conference_zoom_heading' ) ) : function upstudy_video_conference_zoom_heading() { echo '
    '; echo '

    ' . wp_kses_post( get_the_title() ) . '

    '; echo '
    '; } endif; // Left Section Single Content( with heading ) if( ! function_exists( 'upstudy_vczapi_html_after_meeting_details' ) ) : function upstudy_vczapi_html_after_meeting_details() { $extra_meta = get_post_meta( get_the_ID(), 'upstudy_zoom_extra_meta_fields', true ); // var_dump($extra_meta); if ( isset( $extra_meta ) && is_array( $extra_meta ) ) : foreach ( $extra_meta as $key => $meta ) : if ( $meta['label'] ) : $wrapper_class = ''; if ( isset( $meta['wrapper_class'] ) && ! empty( $meta['wrapper_class'] ) ) : $wrapper_class = ' ' . $meta['wrapper_class']; endif; echo '
    '; echo ''; echo esc_html($meta['label']) ? '' . esc_html( $meta['label'] ) . '' : ''; echo ''; echo esc_html($meta['label']) ? ' ' . esc_html( $meta['value'] ) . '' : ''; echo '
    '; endif; endforeach; endif; } endif; add_action( 'vczapi_html_after_meeting_details', 'upstudy_vczapi_html_after_meeting_details' );