3604 lines
126 KiB
PHP
3604 lines
126 KiB
PHP
<?php
|
||
|
||
// Two coluumn menu option for widget
|
||
function upstudy_add_menu_on_off_menu_two_clm_option( $widget, $return, $instance ) {
|
||
|
||
// Are we dealing with a nav menu widget?
|
||
if ( 'nav_menu' == $widget->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'] : '';
|
||
?>
|
||
<p>
|
||
<input class="checkbox" type="checkbox" id="<?php echo esc_attr($widget->get_field_id('on_off_menu_two_clm')); ?>" name="<?php echo esc_attr($widget->get_field_name('on_off_menu_two_clm')); ?>" <?php checked( true , $on_off_menu_two_clm ); ?> />
|
||
<label for="<?php echo esc_attr($widget->get_field_id('on_off_menu_two_clm')); ?>">
|
||
<?php esc_html_e( 'Two Column Menu', 'upstudy' ); ?>
|
||
</label>
|
||
</p>
|
||
<?php
|
||
}
|
||
}
|
||
add_filter('in_widget_form', 'upstudy_add_menu_on_off_menu_two_clm_option', 10, 3 );
|
||
|
||
function upstudy_save_menu_on_off_menu_two_clm_option( $instance, $new_instance ) {
|
||
|
||
// Is the instance a nav menu and are on_off_menu_two_clms enabled?
|
||
if ( isset( $new_instance['nav_menu'] ) && !empty( $new_instance['on_off_menu_two_clm'] ) ) {
|
||
$new_instance['on_off_menu_two_clm'] = 1;
|
||
}
|
||
|
||
return $new_instance;
|
||
}
|
||
add_filter( 'widget_update_callback', 'upstudy_save_menu_on_off_menu_two_clm_option', 10, 2 );
|
||
|
||
|
||
// Two column menu input save
|
||
function upstudy_in_widget_form_update($instance, $new_instance, $old_instance){
|
||
|
||
$instance['on_off_menu_two_clm'] = isset($new_instance['on_off_menu_two_clm']);
|
||
|
||
return $instance;
|
||
}
|
||
|
||
// Two column menu class output
|
||
function upstudy_dynamic_sidebar_params($params){
|
||
global $wp_registered_widgets;
|
||
$widget_id = $params[0]['widget_id'];
|
||
$widget_obj = $wp_registered_widgets[$widget_id];
|
||
$widget_opt = get_option($widget_obj['callback'][0]->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 '<header class="' . esc_attr( implode( ' ', $classes ) ) . '">';
|
||
echo '<div class="upstudy-header-container"' . trim( $bg_color ) . '>';
|
||
if ( $sticky_header ) :
|
||
echo '<div class="upstudy-sticky-header-wrapper">';
|
||
else :
|
||
echo '<div class="upstudy-non-sticky-header-wrapper">';
|
||
endif;
|
||
echo apply_filters( 'upstudy_generate_post_builder', do_shortcode( $post->post_content ), $post, $post->ID );
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</header>';
|
||
|
||
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 '<footer id="upstudy-footer" class="' . esc_attr( implode( ' ', $classes ) ) . '">';
|
||
echo '<div class="upstudy-footer-inner">';
|
||
echo apply_filters( 'upstudy_generate_post_builder', do_shortcode( $post->post_content ), $post, $post->ID);
|
||
echo '</div>';
|
||
echo '</footer>';
|
||
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('<a href="%s">%s</a>', 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( '<a href="%s" target="%s">%s</a>', esc_url( $facebook ), esc_attr( $link_tab ), esc_html__( 'Facebook', 'upstudy' ) ) : '';
|
||
$twitter ? printf( '<a href="%s" target="%s">%s</a>', esc_url( $twitter ), esc_attr( $link_tab ), esc_html__( 'Twitter', 'upstudy' ) ) : '';
|
||
$linkedin ? printf( '<a href="%s" target="%s">%s</a>', esc_url( $linkedin ), esc_attr( $link_tab ), esc_html__( 'Linkedin', 'upstudy' ) ) : '';
|
||
$youtube ? printf( '<a href="%s" target="%s">%s</a>', 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 ). '"><a class="get__title-link" href="' . esc_url( get_permalink() ) . '">' . wp_kses_post( $title ) . '</a></' . esc_attr( $tag ) . '>';
|
||
endif;
|
||
|
||
return '';
|
||
}
|
||
endif;
|
||
|
||
/**
|
||
* Logo Setup
|
||
*/
|
||
if ( ! function_exists( 'upstudy_logo_setup' ) ) :
|
||
function upstudy_logo_setup(){
|
||
global $post;
|
||
echo '<div class="logo-wrapper" itemscope itemtype="http://schema.org/Brand">';
|
||
|
||
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 '<a href="' . esc_url( home_url( '/' ) ) . '" class="navbar-brand site-main-logo page-custom-logo">';
|
||
echo '<img class="site-logo" src="' . esc_url( $page_custom_logo ) . '">';
|
||
echo '</a>';
|
||
|
||
upstudy_white_logo();
|
||
echo '</div>';
|
||
return;
|
||
endif;
|
||
endif;
|
||
|
||
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) :
|
||
the_custom_logo();
|
||
else :
|
||
echo '<a href="' . esc_url( home_url( '/' ) ) . '" class="navbar-brand site-main-logo">';
|
||
echo '<img class="site-logo" src="' . esc_url( get_template_directory_uri().'/assets/images/logo.png' ) . '" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '">';
|
||
echo '</a>';
|
||
endif;
|
||
|
||
upstudy_white_logo();
|
||
|
||
echo '</div>';
|
||
}
|
||
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 '<a href="' . esc_url( home_url( '/' ) ) . '" class="navbar-brand site-white-logo">';
|
||
echo '<img src="' . esc_url( $white_logo ) . '" class="header-white-logo" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '" />';
|
||
echo '</a>';
|
||
endif;
|
||
}
|
||
endif;
|
||
|
||
/**
|
||
* Menu Setup
|
||
*/
|
||
if ( ! function_exists( 'upstudy_menu_setup' ) ) :
|
||
function upstudy_menu_setup(){
|
||
if ( has_nav_menu( 'primary' ) ) :
|
||
echo '<nav id="site-navigation" class="main-navigation upstudy-theme-nav upstudy-navbar-collapse">';
|
||
echo '<div class="upstudy-navbar-primary-menu">';
|
||
do_action( 'upstudy_before_main_menu' );
|
||
wp_nav_menu( array(
|
||
'theme_location' => 'primary',
|
||
'depth' => 8,
|
||
'container' => 'div',
|
||
'container_class'=> 'primary-menu-container-class',
|
||
'container_id' => 'primary-menu-container-id',
|
||
'menu_class' => 'upstudy-default-header-navbar upstudy-navbar-nav upstudy-navbar-right',
|
||
'menu_id' => 'primary-menu-custom-id',
|
||
'fallback_cb' => 'Upstudy_NavWalker::fallback',
|
||
'walker' => new Upstudy\Navwalker\Upstudy_NavWalker()
|
||
) );
|
||
do_action( 'upstudy_after_main_menu' );
|
||
echo '</div>';
|
||
echo '</nav>';//#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 '<div class="upstudy-mobile-menu">';
|
||
echo '<div class="upstudy-mobile-menu-overlay"></div>';
|
||
|
||
echo '<div class="upstudy-mobile-menu-nav-wrapper">';
|
||
echo '<div class="responsive-header-top">';
|
||
echo '<div class="responsive-header-logo">';
|
||
upstudy_logo_setup();
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-mobile-menu-close">';
|
||
echo '<a href="#" onclick="event.preventDefault();">';
|
||
echo '<i class="dt-icon-close"></i>';
|
||
echo '</a>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
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 '</div>';
|
||
echo '</div>';
|
||
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 '<div class="edu-header-search-field' . esc_attr( $extra_class ) . '">';
|
||
echo '<div class="inner">';
|
||
echo '<form action="' . esc_url( home_url( '/' ) ) .'" class="search-form" method="get">';
|
||
echo '<input type="text" class="upstudy-search-popup-field" name="s" value="' . esc_attr( get_search_query() ) . '" placeholder="' . esc_attr__( 'Search', 'upstudy') . '">';
|
||
echo '<button class="submit-button"><i class="dt-icon-search"></i></button>';
|
||
echo '</form>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-search-box">';
|
||
echo '<div class="upstudy-search-form">';
|
||
|
||
echo '<div class="upstudy-closebtn">';
|
||
echo '<span></span>';
|
||
echo '<span></span>';
|
||
echo '</div>';
|
||
|
||
echo '<form action="';
|
||
// Default to WordPress site-wide search
|
||
echo esc_url(home_url('/'));
|
||
echo '" method="get">';
|
||
|
||
echo '<div class="input-search-wrap">';
|
||
echo '<input type="text" value="" name="s" placeholder="'. esc_attr__( 'Search Here..', 'upstudy' ) . '" class="input-search" autocomplete="off" />';
|
||
echo '<span class="upstudy-input-focus-border"></span> ';
|
||
// Hidden input for specific search types
|
||
if ($search_type == 'tpc_wp_search') {
|
||
echo '<input type="hidden" value="" name="post_type" />';
|
||
}
|
||
|
||
echo '<button><i class="dt-icon-search"></i></button>';
|
||
echo '</div>';
|
||
echo '</form>';
|
||
|
||
echo '</div>';
|
||
echo '</div>';
|
||
} //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 '<div class="upstudy-search-box">';
|
||
echo '<div class="upstudy-search-form">';
|
||
|
||
echo '<div class="upstudy-closebtn">';
|
||
|
||
echo '<span></span>';
|
||
echo '<span></span>';
|
||
|
||
echo '</div>';
|
||
echo '<form action="';
|
||
if ($search_type == 'tpc_tutor_search') {
|
||
echo esc_url(get_post_type_archive_link('courses'));
|
||
} elseif ($search_type == 'tpc_lp_search') {
|
||
echo esc_url(get_post_type_archive_link('lp_course'));
|
||
} elseif ($search_type == 'tpc_ld_search') {
|
||
echo esc_url(get_post_type_archive_link('sfwd-courses'));
|
||
}
|
||
echo '" method="get">';
|
||
echo '<input type="text" value="" name="search_query" placeholder="'. __( 'Search Here..', 'upstudy' ) . '" class="input-search" autocomplete="off" />';
|
||
echo '<input type="hidden" value="lp_course_search" name="tpc_lp_course_filter" />';
|
||
echo '<button><i class="dt-icon-search"></i></button>';
|
||
echo '</form>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
}
|
||
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 '<div class="quote-icon quote-user">';
|
||
if ( $icon_with_text ) :
|
||
echo '<a class="header-login-register button-text-with-icon" href="' . esc_url( wp_login_url( get_permalink() ) ) . '" target="_blank"><i class="ri-user-line"></i><span class="button-text">' . __( 'Login / Register', 'upstudy' ). '</span></a>';
|
||
else :
|
||
echo '<a class="header-login-register" href="' . esc_url( wp_login_url( get_permalink() ) ) . '" target="_blank"><i class="ri-user-line"></i></a>';
|
||
endif;
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="quote-icon quote-user">';
|
||
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 '<a href="' . esc_url( $profile_url ) . '">';
|
||
echo get_avatar( $user_id, 100 );
|
||
echo '</a>';
|
||
else :
|
||
echo get_avatar( $user_id, 100 );
|
||
endif;
|
||
else :
|
||
if ( $icon_with_text ) :
|
||
echo '<a class="header-login-register button-text-with-icon" href="' . esc_url( wp_login_url( get_permalink() ) ) . '" target="_blank"><i class="ri-user-line"></i><span class="button-text">' . __( 'Login / Register', 'upstudy' ) . '</span></a>';
|
||
else :
|
||
echo '<a class="header-login-register" href="' . esc_url( wp_login_url( get_permalink() ) ) . '" target="_blank"><i class="ri-user-line"></i></a>';
|
||
endif;
|
||
endif;
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="' . esc_attr( $class ) . '">';
|
||
echo '<nav class="main-navigation">';
|
||
echo '<ul class="category-menu upstudy-navbar-nav">';
|
||
echo '<li class="cat-menu-item dropdown">';
|
||
echo '<a class="cat-menu-anchor-item">';
|
||
echo '<i class="dt-icon-menu-1"></i>';
|
||
echo esc_html( $title );
|
||
echo '</a>';
|
||
echo '<ul class="upstudy-dropdown-menu">';
|
||
upstudy_header_category_items();
|
||
echo '</ul>';
|
||
echo '</a>';
|
||
echo '</ul>';
|
||
echo '</nav>';
|
||
echo '</div>';
|
||
}
|
||
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 '<li class="cat-item">';
|
||
echo '<a href="' . esc_url( get_term_link( $category ) ) . '">';
|
||
echo esc_html( $category->name );
|
||
echo '</a>';
|
||
echo '</li>';
|
||
endforeach;
|
||
else :
|
||
echo '<li class="cat-item"><a class="no-cat-found">' . esc_html( 'No Category Found', 'upstudy' ) . '</a></li>';
|
||
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 '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn upstudy-btn btn-small' . esc_attr( $extra_class ) . '">' . wp_kses_post( $button_text ) . '</a>';
|
||
elseif ($header_button_show && $button_text ) :
|
||
echo '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn upstudy-btn btn-small' . esc_attr( $extra_class ) . '">' . __( 'Try for free', 'upstudy' ) . '<i class="dt-icon-right-arrow"></i></a>';
|
||
endif;
|
||
}
|
||
endif;
|
||
|
||
/**
|
||
* Header Responsive Menu Toggle
|
||
*/
|
||
if ( ! function_exists( 'upstudy_header_responsive_toggle' ) ) :
|
||
function upstudy_header_responsive_toggle() {
|
||
echo '<div class="quote-icon upstudy-theme-nav-responsive hamburger-icon">';
|
||
echo '<div class="upstudy-mobile-hamburger-menu">';
|
||
echo '<a href="#" onclick="event.preventDefault();">';
|
||
echo '<i class="dt-icon-burger-menu"></i>';
|
||
echo '</a>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-woo-mini-cart-wrapper woocommerce" id="upstudy-cart-fragment">';
|
||
echo '<div class="upstudy-woo-mini-cart-inner">';
|
||
echo '<div class="upstudy-woo-mini-cart-icon-wrapper upstudy-woo-mini-cart-active-on-hover">';
|
||
|
||
printf(
|
||
'<a class="%1$s" href="%2$s" target="_self"><i aria-hidden="true" class="dt-icon-shopping-cart"></i></a>',
|
||
esc_attr( 'upstudy-woo-mini-cart-link upstudy-woo-mini-cart-visible-on-hover' ),
|
||
esc_url( $cart_url )
|
||
);
|
||
|
||
printf(
|
||
'<span class="%1$s">%2$s</span>',
|
||
esc_attr( 'upstudy-woo-mini-cart-total-item' ),
|
||
esc_html( $total_count )
|
||
);
|
||
|
||
echo '<div class="upstudy-woo-mini-cart-content">';
|
||
echo '<div class="widget_shopping_cart_content">';
|
||
|
||
// 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 '<div class="upstudy-tutor-mini-cart-items">';
|
||
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 '<div class="upstudy-mini-cart-each-item woocommerce-mini-cart-item mini_cart_item">';
|
||
echo '<div class="upstudy-mini-cart-item-thumb">';
|
||
echo '<a href="' . esc_url( get_the_permalink( $course_id ) ) . '">';
|
||
echo '<img width="75" height="75" src="' . esc_url( $thumb ) . '" alt="' . esc_attr( $course_title ) . '">';
|
||
echo '</a>';
|
||
echo '</div>';
|
||
echo '<div class="upstudy-mini-cart-product-name-quantity">';
|
||
echo '<a href="' . esc_url( get_the_permalink( $course_id ) ) . '">' . esc_html( $course_title ) . '</a>';
|
||
echo '<span class="quantity">1 × <span class="woocommerce-Price-amount amount"><bdi>' . $formatted . '</bdi></span></span>';
|
||
echo '</div>';
|
||
echo '<a href="#" class="remove tutor-mini-cart-remove" data-course-id="' . esc_attr( $course_id ) . '">×</a>';
|
||
echo '</div>';
|
||
}
|
||
echo '</div>';
|
||
}
|
||
|
||
// if nothing to show
|
||
if ( empty( $tutor_items ) && ! $is_wc_active ) {
|
||
echo '<div class="upstudy-cart-empty-content">';
|
||
echo '<p class="upstudy-cart-empty-text">' . esc_html__( 'No items in the cart', 'upstudy' ) . '</p>';
|
||
echo '</div>';
|
||
}
|
||
|
||
echo '</div>'; // .widget_shopping_cart_content
|
||
echo '</div>'; // .upstudy-woo-mini-cart-content
|
||
|
||
echo '</div>'; // .upstudy-woo-mini-cart-icon-wrapper
|
||
echo '</div>'; // .upstudy-woo-mini-cart-inner
|
||
echo '</div>'; // .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 '<div class="upstudy-woo-mini-cart-wrapper woocommerce">';
|
||
// echo '<div class="upstudy-woo-mini-cart-inner">';
|
||
// echo '<div class="upstudy-woo-mini-cart-icon-wrapper upstudy-woo-mini-cart-active-on-hover">';
|
||
// echo '<a class="upstudy-woo-mini-cart-link upstudy-woo-mini-cart-visible-on-hover" href="' . esc_url( $cart_url ? $cart_url : '#' ) . '" target="_self">';
|
||
// echo '<i aria-hidden="true" class="dt-icon-shopping-cart"></i>';
|
||
// echo '</a>';
|
||
|
||
// echo '<span class="upstudy-woo-mini-cart-total-item">';
|
||
// echo esc_html( $total_count );
|
||
// echo '</span>';
|
||
|
||
// echo '<div class="upstudy-woo-mini-cart-content">';
|
||
// echo '<div class="widget_shopping_cart_content">';
|
||
|
||
// if ( is_array( $course_list ) && count( $course_list ) ) {
|
||
// echo '<div class="upstudy-mini-cart-items woocommerce-mini-cart cart_list product_list_widget">';
|
||
|
||
// // 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 '<div class="upstudy-mini-cart-each-item woocommerce-mini-cart-item mini_cart_item">';
|
||
// echo '<div class="upstudy-mini-cart-item-thumb">';
|
||
// echo '<a href="' . esc_url( get_the_permalink( $course ) ) . '">';
|
||
// echo '<img width="75" height="75" src="' . esc_url( $tutor_course_img ) . '" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail" alt="' . esc_attr( $course_title ) . '" decoding="async">';
|
||
// echo '</a>';
|
||
// echo '</div>';
|
||
// echo '<div class="upstudy-mini-cart-product-name-quantity">';
|
||
// echo '<a href="' . esc_url( get_the_permalink( $course ) ) . '">' . $course_title . '</a>';
|
||
// echo '<span class="quantity">1 × <span class="woocommerce-Price-amount amount">';
|
||
// echo '<bdi>';
|
||
// echo $formatted_price;
|
||
// echo '</bdi>';
|
||
// echo '</span></span>';
|
||
// echo '</div>';
|
||
// echo '<a href="#" class="remove remove_from_cart_button tutor-mini-cart-remove" aria-label="Remove this item" data-course-id="' . esc_attr( $course->ID ) . '">×</a>';
|
||
// echo '</div>';
|
||
// }
|
||
|
||
// echo '</div>';
|
||
|
||
// // Format the subtotal for display
|
||
// $formatted_subtotal = tutor_get_formatted_price( $subtotal );
|
||
|
||
// echo '<p class="woocommerce-mini-cart__total total">';
|
||
// echo '<strong>' . esc_html__( 'Subtotal:', 'tutor' ) . '</strong>';
|
||
// echo '<span class="woocommerce-Price-amount amount">';
|
||
// echo '<bdi>';
|
||
// echo $formatted_subtotal;
|
||
// echo '</bdi>';
|
||
// echo '</span>';
|
||
// echo '</p>';
|
||
|
||
// echo '<p class="woocommerce-mini-cart__buttons buttons">';
|
||
// echo '<a href="' . esc_url( $cart_url ? $cart_url : '#' ) . '" class="button wc-forward">' . esc_html__( 'View cart', 'tutor' ) . '</a>';
|
||
// echo '<a href="' . esc_url( $checkout_url ) . '" class="button checkout wc-forward">' . esc_html__( 'Checkout', 'tutor' ) . '</a>';
|
||
// echo '</p>';
|
||
|
||
// } else {
|
||
// echo '<div class="upstudy-cart-empty-content">';
|
||
// echo '<p class="upstudy-cart-empty-text">' . esc_html__( 'No courses in the cart', 'tutor' ) . '</p>';
|
||
// if ( function_exists( 'tutor_utils' ) ) {
|
||
// echo '<p class="upstudy-cart-shop-page-link">';
|
||
// echo '<a href="' . esc_url( tutor_utils()->course_archive_page_url() ) . '" class="button wc-forward">' . esc_html__( 'Browse Courses', 'tutor' ) . '</a>';
|
||
// echo '</p>';
|
||
// }
|
||
// echo '</div>';
|
||
// }
|
||
|
||
// echo '</div>';
|
||
// echo '</div>';
|
||
// echo '</div>';
|
||
// echo '</div>';
|
||
// echo '</div>';
|
||
|
||
// // Add JavaScript for cart functionality
|
||
// echo '<script>
|
||
// jQuery(document).ready(function($) {
|
||
// // Remove course from cart
|
||
// $(".tutor-mini-cart-remove").on("click", function(e) {
|
||
// e.preventDefault();
|
||
// var courseId = $(this).data("course-id");
|
||
// var $cartItem = $(this).closest(".upstudy-mini-cart-each-item");
|
||
|
||
// $.ajax({
|
||
// url: "' . admin_url('admin-ajax.php') . '",
|
||
// type: "POST",
|
||
// data: {
|
||
// action: "tutor_remove_from_cart",
|
||
// course_id: courseId,
|
||
// security: "' . wp_create_nonce('tutor_nonce') . '"
|
||
// },
|
||
// beforeSend: function() {
|
||
// $cartItem.addClass("removing");
|
||
// },
|
||
// success: function(response) {
|
||
// if (response.success) {
|
||
// $cartItem.fadeOut(300, function() {
|
||
// $(this).remove();
|
||
// // Update cart count
|
||
// var currentCount = parseInt($(".upstudy-woo-mini-cart-total-item").text());
|
||
// $(".upstudy-woo-mini-cart-total-item").text(currentCount - 1);
|
||
|
||
// // If no items left, show empty message
|
||
// if (currentCount - 1 === 0) {
|
||
// $(".upstudy-woo-mini-cart-content .widget_shopping_cart_content").html(\'<div class="upstudy-cart-empty-content"><p class="upstudy-cart-empty-text">' . esc_html__( 'No courses in the cart', 'tutor' ) . '</p><p class="upstudy-cart-shop-page-link"><a href="' . (function_exists( 'tutor_utils' ) ? esc_url( tutor_utils()->course_archive_page_url() ) : '#') . '" class="button wc-forward">' . esc_html__( 'Browse Courses', 'tutor' ) . '</a></p></div>\');
|
||
// } else {
|
||
// // Recalculate subtotal if needed
|
||
// location.reload();
|
||
// }
|
||
// });
|
||
// }
|
||
// }
|
||
// });
|
||
// });
|
||
// });
|
||
// </script>';
|
||
// } else {
|
||
// return;
|
||
// }
|
||
// }
|
||
// endif;
|
||
|
||
/**
|
||
* Header Search Icon
|
||
*/
|
||
if ( ! function_exists( 'upstudy_header_search_toggle' ) ) :
|
||
function upstudy_header_search_toggle() {
|
||
|
||
|
||
echo '<div class="header-quote">';
|
||
echo '<div class="quote-icon">';
|
||
echo '<a href="#" id="search"><i class="dt-icon-search"></i></a>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
}
|
||
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 '<header id="masthead" class="' . esc_attr( implode( ' ', $classes ) ) . '">';
|
||
upstudy_header_top_bar();
|
||
upstudy_header();
|
||
echo '</header>'; //#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 '<div class="upstudy-header-area upstudy-navbar upstudy-navbar-expand-lg">';
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_header_container_class', $container_class ) ) . '">';
|
||
echo '<div class="tpc-header-navbar upstudy-align-items-center">';
|
||
|
||
echo '<div class="site-branding site-logo-info">';
|
||
upstudy_logo_setup();
|
||
echo '</div>';
|
||
|
||
if ( 'theme-header-1' === $header ) :
|
||
upstudy_header_category();
|
||
endif;
|
||
|
||
if ( 'theme-header-1' === $header ) :
|
||
upstudy_header_search_field( $search_field );
|
||
endif;
|
||
|
||
echo '<div class="upstudy-theme-header-nav upstudy-d-none upstudy-d-xl-block">';
|
||
upstudy_menu_setup();
|
||
echo '</div>';
|
||
|
||
if ( Upstudy::setting( 'login_popup_active' ) || Upstudy::setting( 'top_search_enable' ) || Upstudy::setting( 'top_cart_enable' ) ) {
|
||
upstudy_header_right_side_content();
|
||
}
|
||
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-header-right-side">';
|
||
|
||
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 '<div class="upstudy-login-register-wrapper">';
|
||
if( ! is_user_logged_in() ) :
|
||
|
||
echo '<a href="'. esc_url( $get_the_custom_login_link ) .'" class="tpc-login-register-popup-trigger-js-none">';
|
||
echo '<i class="dt-icon-user"></i>';
|
||
echo esc_html($get_the_top_login_button_text);
|
||
echo '</a>';
|
||
|
||
else :
|
||
|
||
if ( function_exists( 'upstudy_user_profile_menu' ) && is_user_logged_in() && $profile_show ) :
|
||
upstudy_user_profile_menu();
|
||
endif;
|
||
|
||
endif;
|
||
echo '</div>';
|
||
}
|
||
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 '</div>';
|
||
}
|
||
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 '<div class="tpc-header-top-bar tpc-top-bar-style-' . esc_attr( $top_bar_type ) . '">';
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_header_top_bar_container_class', $container_class ) ) . '">';
|
||
echo '<div class="upstudy-header-top-content">';
|
||
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 '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
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 '<div class="header-top-social-share">';
|
||
|
||
echo '<span class="follow-us">';
|
||
if($follow_us_show) {
|
||
if($follow_us_text) {
|
||
echo esc_html($follow_us_text);
|
||
} else {
|
||
echo esc_html__( 'Follow Us :', 'upstudy' );
|
||
}
|
||
}
|
||
echo '</span>';
|
||
|
||
foreach($upstudy_social_links as $upstudy_social_handle) :
|
||
if (!empty($upstudy_social_handle)) {
|
||
|
||
echo '<span class="header-top-social-item">';
|
||
echo '<a href="' . esc_url($upstudy_social_handle['header_icon_link']) . '"';
|
||
if (!empty($upstudy_social_handle['header_icon_title'])) {
|
||
echo ' title="' . esc_attr($upstudy_social_handle['header_icon_title']) . '"';
|
||
}
|
||
echo '><i';
|
||
if (!empty($upstudy_social_handle['header_icons_color'])) {
|
||
echo ' style="color:' . esc_attr($upstudy_social_handle['header_icons_color']) . '"';
|
||
}
|
||
echo ' class="' . esc_attr($upstudy_social_handle['header_icon_icons']) . '"></i></a>';
|
||
echo '</span>';
|
||
}
|
||
endforeach;
|
||
echo '</div>';
|
||
|
||
}
|
||
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 '<div class="header-top-left">';
|
||
|
||
if ( $phone ) :
|
||
echo '<div class="header-top-phone">';
|
||
if ( !empty($top_phone_link) ) {
|
||
echo '<a href="tel:' . esc_attr($top_phone_link) . '"><i class="dt-icon-phone-call"></i> ' . esc_html($phone) . '</a>';
|
||
} else {
|
||
// If the option is disabled, just display the phone number without the anchor tag.
|
||
echo '<i class="dt-icon-phone-call"></i> ' . esc_html($phone);
|
||
}
|
||
echo '</div>';
|
||
endif;
|
||
|
||
if ( $email ) :
|
||
echo '<div class="header-top-email">';
|
||
if ( ! empty( $top_email_link ) ) {
|
||
echo '<a href="mailto:' . esc_attr( $top_email_link ) . '"><i class="dt-icon-envelope"></i>' . esc_html( $email ) . '</a>';
|
||
} else {
|
||
echo '<span><i class="dt-icon-envelope"></i>' . esc_html( $email ) . '</span>';
|
||
}
|
||
echo '</div>';
|
||
endif;
|
||
|
||
echo '</div>';
|
||
endif;
|
||
|
||
echo '<div class="header-top-center">';
|
||
if ( $top_massage ) :
|
||
echo '<div class="header-top-message">';
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '<marquee width='. esc_attr($top_massage_area_width) .'px scrollamount="3">';
|
||
}
|
||
echo wp_kses_post( $top_massage );
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '</marquee>';
|
||
}
|
||
|
||
echo '</div>';
|
||
endif;
|
||
echo '</div>';
|
||
|
||
echo '<div class="header-top-right">';
|
||
|
||
|
||
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 '<div class="header-top-widget-wrap">';
|
||
dynamic_sidebar( 'header-top' );
|
||
echo '</div>';
|
||
}
|
||
|
||
|
||
if ( $header_top_button_show ) :
|
||
if ( $button_text ) :
|
||
|
||
echo '<div class="header-top-click-button">';
|
||
echo '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn">' . wp_kses_post( $button_text ) . '</a>';
|
||
echo '</div>';
|
||
|
||
else :
|
||
|
||
echo '<div class="header-top-click-button">';
|
||
echo '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn">Apply Now</a>';
|
||
echo '</div>';
|
||
|
||
endif;
|
||
endif;
|
||
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="header-top-left">';
|
||
|
||
if ( $phone ) :
|
||
echo '<div class="header-top-phone">';
|
||
if ( !empty($top_phone_link) ) {
|
||
echo '<a href="tel:' . esc_attr($top_phone_link) . '"><i class="dt-icon-phone-call"></i> ' . esc_html($phone) . '</a>';
|
||
} else {
|
||
// If the option is disabled, just display the phone number without the anchor tag.
|
||
echo '<i class="dt-icon-phone-call"></i> ' . esc_html($phone);
|
||
}
|
||
echo '</div>';
|
||
endif;
|
||
|
||
if ( $email ) :
|
||
echo '<div class="header-top-email">';
|
||
if ( ! empty( $top_email_link ) ) {
|
||
echo '<a href="mailto:' . esc_attr( $top_email_link ) . '"><i class="dt-icon-envelope"></i>' . esc_html( $email ) . '</a>';
|
||
} else {
|
||
echo '<span><i class="dt-icon-envelope"></i>' . esc_html( $email ) . '</span>';
|
||
}
|
||
echo '</div>';
|
||
endif;
|
||
|
||
echo '</div>';
|
||
endif;
|
||
|
||
echo '<div class="header-top-center">';
|
||
if ( $top_massage ) :
|
||
echo '<div class="header-top-message">';
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '<marquee width='. esc_attr($top_massage_area_width) .'px scrollamount="3">';
|
||
}
|
||
echo wp_kses_post( $top_massage );
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '</marquee>';
|
||
}
|
||
|
||
echo '</div>';
|
||
endif;
|
||
echo '</div>';
|
||
|
||
echo '<div class="header-top-right">';
|
||
|
||
|
||
if ( $social_icons && 'theme-header-4' !== $header) :
|
||
upstudy_header_top_social_share();
|
||
endif;
|
||
|
||
if ( $header_top_button_show ) :
|
||
if ( $button_text ) :
|
||
|
||
echo '<div class="header-top-click-button">';
|
||
echo '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn">' . wp_kses_post( $button_text ) . '</a>';
|
||
echo '</div>';
|
||
|
||
else :
|
||
|
||
echo '<div class="header-top-click-button">';
|
||
echo '<a href="' . esc_url( $button_url ). '" target="' . esc_attr( $tab ) . '" class="main-header-btn">Apply Now</a>';
|
||
echo '</div>';
|
||
|
||
endif;
|
||
endif;
|
||
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="header-top-center">';
|
||
if ( $top_massage ) :
|
||
echo '<div class="header-top-message">';
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '<marquee width="100%" direction="left" scrollamount="10">';
|
||
}
|
||
echo wp_kses_post($top_massage);
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '</marquee>';
|
||
}
|
||
|
||
echo '</div>';
|
||
else :
|
||
if ( $top_massage_animation_show ) {
|
||
echo '<marquee width="100%" direction="left" scrollamount="10">';
|
||
}
|
||
echo "Add your notice in top message option! & Enabled the animation options";
|
||
|
||
if ( $top_massage_animation_show ) {
|
||
echo '</marquee>';
|
||
}
|
||
endif;
|
||
echo '</div>';
|
||
|
||
}
|
||
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 '<div class="shape-dot-wrapper shape-wrapper upstudy-d-xl-block upstudy-d-none">';
|
||
|
||
echo '<div class="shape-image tpc-mouse-animation shape-3">';
|
||
echo '<span data-depth="2">';
|
||
echo '<img src="' . esc_url( get_template_directory_uri() . '/assets/images/shapes/HE001.png' ) . '" alt="Breadcrumb Abstract Shape">';
|
||
echo '</span>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="shape-image tpc-mouse-animation shape-4">';
|
||
echo '</div>';
|
||
|
||
echo '<div class="shape-image tpc-mouse-animation shape-5">';
|
||
echo '<span data-depth="2">';
|
||
echo '<img src="' . esc_url( get_template_directory_uri() . '/assets/images/shapes/HE005.png' ) . '" alt="Breadcrumb Abstract Shape">';
|
||
echo '</span>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
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 '<div class="upstudy-page-title-area upstudy-default-breadcrumb '. esc_attr( $has_bg_image ) .'"' . $extra_style .'>';
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
||
echo '<div class="upstudy-page-title">';
|
||
echo '<'.$header_title_tag.' class="page-title has-text-align-'.$header_page_title_align.'">';
|
||
echo wp_kses_post( $title );
|
||
echo '</'.$header_title_tag.' class="page-title">';
|
||
echo '</div>';
|
||
|
||
if ( $breadcrumb_show ) {
|
||
echo '<div class="upstudy-breadcrumb-wrapper has-text-align-'.$header_page_title_align.'">';
|
||
do_action( 'upstudy_breadcrumb' );
|
||
echo '</div>';
|
||
}
|
||
|
||
echo '</div>';
|
||
|
||
upstudy_breadcrumb_shapes();
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-page-title-area upstudy-breadcrumb-style-1 '. esc_attr( $has_bg_image ) .'"' . $extra_style .'>';
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
||
|
||
echo '<div class="upstudy-page-title">';
|
||
echo '<'.$header_title_tag.' class="page-title has-text-align-'.$header_page_title_align.'">';
|
||
echo wp_kses_post( $title );
|
||
echo '</'.$header_title_tag.' class="page-title">';
|
||
echo '</div>';
|
||
|
||
if ($breadcrumb_show) {
|
||
echo '<div class="upstudy-breadcrumb-wrapper has-text-align-'.$header_page_title_align.'">';
|
||
do_action( 'upstudy_breadcrumb' );
|
||
echo '</div>';
|
||
}
|
||
|
||
echo '</div>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-breadcrumb-style-2">';
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
||
|
||
if ( $breadcrumb_show ) {
|
||
echo '<div class="upstudy-breadcrumb-wrapper">';
|
||
do_action( 'upstudy_breadcrumb' );
|
||
echo '</div>';
|
||
}
|
||
|
||
echo '</div>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="upstudy-page-title-area upstudy-breadcrumb-style-blog-overlay '. esc_attr( $has_bg_image ) .' '.$shape_enable_class.'"' . $extra_style .'>';
|
||
|
||
if($blog_single_img_overlay_shape){
|
||
upstudy_breadcrumb_shapes();
|
||
}
|
||
|
||
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
||
|
||
echo '<div class="upstudy-page-title '.$align_class.'">';
|
||
if($blog_single_category_show){
|
||
echo '<div class="upstudy-cat-wrapper">';
|
||
echo '<span class="upstudy-post-cat">' . wp_kses_post( upstudy_category_by_id( get_the_ID(), 'category' ) ) . '</span>';
|
||
echo '</div>';
|
||
}
|
||
echo '<h1 class="entry-title">';
|
||
echo wp_kses_post( $title );
|
||
echo '</h1>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="blog-details-top">';
|
||
echo '<ul class="blog-meta">';
|
||
if ( $blog_single_author_show ){
|
||
upstudy_posted_author_with_thumb();
|
||
};
|
||
|
||
if ( $blog_single_date_show ) {
|
||
echo '<li>';
|
||
echo esc_html( get_the_date() );
|
||
echo '</li>';
|
||
}
|
||
|
||
if ( $blog_single_comment_show ) {
|
||
echo '<li>';
|
||
echo '<a href="'.esc_url(get_comments_link()).'">';
|
||
printf(
|
||
/* translators: 1: comment count number, 2: title. */
|
||
esc_html( _nx( '%1$s %2$s', '%1$s %2$s', get_comments_number(), 'comments title', 'upstudy' ) ),
|
||
number_format_i18n( get_comments_number() ),
|
||
$blog_comments_text,
|
||
'<span>' . get_the_title() . '</span>'
|
||
);
|
||
echo '</a>';
|
||
echo '</li>';
|
||
}
|
||
|
||
echo '</ul>';
|
||
|
||
if (Upstudy::setting( 'blog_single_like_show' )) {
|
||
if ( function_exists( 'upstudy_render_like_button' ) ) {
|
||
upstudy_render_like_button();
|
||
}
|
||
}
|
||
|
||
|
||
echo '</div>';
|
||
// if ($breadcrumb_show) {
|
||
// echo '<div class="upstudy-breadcrumb-wrapper">';
|
||
// do_action( 'upstudy_breadcrumb' );
|
||
// echo '</div>';
|
||
// }
|
||
|
||
echo '</div>';
|
||
|
||
echo '</div>';
|
||
}
|
||
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' ),
|
||
'<span>' . esc_html( get_search_query() ) . '</span>'
|
||
);
|
||
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 = '<li><span class="active">';
|
||
$after = '</span></li>';
|
||
|
||
if ( ! is_front_page() || is_paged() ) :
|
||
global $post;
|
||
$homeURL = esc_url( home_url() );
|
||
|
||
echo '<nav class="upstudy-breadcrumb">';
|
||
echo '<ul class="breadcrumb">';
|
||
echo '<li><a href="' . esc_url( $homeURL ) . '">' . wp_kses_post( $main_home ) . '</a> ' . wp_kses_post( $spacer ) . '</li> ';
|
||
|
||
if ( is_category() ) :
|
||
global $wp_query;
|
||
$cat_obj = $wp_query->get_queried_object();
|
||
$thisCat = $cat_obj->term_id;
|
||
$thisCat = get_category( $thisCat );
|
||
$parentCat = get_category( $thisCat->parent );
|
||
echo '<li>';
|
||
if ( $thisCat->parent != 0 )
|
||
echo get_category_parents( $parentCat, TRUE, '</li><li>' );
|
||
echo '<span class="active">' . single_cat_title( '', false ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_day() ) :
|
||
echo '<li><a href="' . esc_url( get_year_link(get_the_time( 'Y' ) ) ) . '">' . get_the_time( 'Y' ) . '</a></li> ' . wp_kses_post( $spacer ) . ' ';
|
||
echo '<li><a href="' . esc_url( get_month_link(get_the_time( 'Y' ),get_the_time( 'm' )) ) . '">' . get_the_time( ' F' ) . '</a></li> ' . wp_kses_post( $spacer ) . ' ';
|
||
echo trim( $before ) . get_the_time( 'd' ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_month() ) :
|
||
echo '<li><a href="' . esc_url( get_year_link(get_the_time( 'Y' ) ) ) . '">' . get_the_time( 'Y' ) . '</a></li> ' . wp_kses_post( $spacer ) . ' ';
|
||
echo trim( $before ) . get_the_time( 'F' ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_year() ) :
|
||
echo trim( $before ) . get_the_time( 'Y' ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_single() && ! is_attachment() ) :
|
||
if ( get_post_type() != 'post' ) :
|
||
$post_type = get_post_type_object( get_post_type() );
|
||
$slug = $post_type->rewrite;
|
||
$slug_url = '';
|
||
|
||
if ( isset( $slug['slug'] ) && ! empty( $slug['slug'] ) ) :
|
||
$slug_url = $slug['slug'] . '/';
|
||
endif;
|
||
if ( is_singular( 'product' ) ) {
|
||
global $post;
|
||
|
||
// Get product categories
|
||
$terms = get_the_terms( $post->ID, 'product_cat' );
|
||
|
||
if ( $terms && ! is_wp_error( $terms ) ) {
|
||
// Use the first category
|
||
$product_cat = reset( $terms );
|
||
$category_name = $product_cat->name;
|
||
$category_url = get_term_link( $product_cat );
|
||
|
||
echo '<li><a href="' . esc_url( $category_url ) . '">' . $category_name . '</a></li> ' . $spacer . ' ';
|
||
} else {
|
||
// Fallback to shop page if no categories
|
||
$shop_page_id = wc_get_page_id('shop');
|
||
$shop_page_title = get_the_title($shop_page_id);
|
||
$shop_page_url = get_permalink($shop_page_id);
|
||
|
||
echo '<li><a href="' . esc_url( $shop_page_url ) . '">' . $shop_page_title . '</a></li> ' . $spacer . ' ';
|
||
}
|
||
} else {
|
||
echo '<li><a href="' . esc_url( $homeURL ) . '/' . $slug_url . '">' . $post_type->labels->singular_name . '</a></li> ' . $spacer . ' ';
|
||
}
|
||
echo trim( $before ) . get_the_title() . wp_kses_post( $after );
|
||
|
||
elseif ( get_post_type() == 'post' ) :
|
||
global $post;
|
||
// $cat = get_the_category(); $cat = $cat[0];
|
||
// echo '<li>'.get_category_parents($cat, TRUE, '</li><li class="hidden">');
|
||
// echo '<span class="active">'. $post->post_title . wp_kses_post( $after );
|
||
|
||
$cat = get_the_category();
|
||
if (!empty($cat)) {
|
||
$cat = $cat[0];
|
||
echo '<li>' . get_category_parents($cat, TRUE, '</li><li class="hidden">');
|
||
}
|
||
echo '<li><span class="active">' . $post->post_title . wp_kses_post($after) . '</li>';
|
||
|
||
else :
|
||
$cat = get_the_category(); $cat = $cat[0];
|
||
echo '<li>'.get_category_parents($cat, TRUE, '</li>');
|
||
endif;
|
||
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 ) ) :
|
||
echo trim( $before ) . $post_type->labels->singular_name . wp_kses_post( $after );
|
||
endif;
|
||
|
||
elseif ( is_404() ) :
|
||
echo trim( $before) . __( 'Error 404', 'upstudy' ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_attachment() ) :
|
||
$parent = get_post($post->post_parent);
|
||
$cat = get_the_category($parent->ID);
|
||
echo '<li>';
|
||
|
||
if ( ! empty( $cat ) ) :
|
||
$cat = $cat[0];
|
||
echo get_category_parents($cat, TRUE, '</li><li>');
|
||
endif;
|
||
|
||
if ( ! empty( $parent ) ) :
|
||
echo '<a href="' . esc_url( get_permalink( $parent ) ) . '">' . $parent->post_title . '</a></li><li>';
|
||
endif;
|
||
echo '<span class="active">'.get_the_title() . wp_kses_post( $after );
|
||
|
||
elseif ( is_page() ) :
|
||
$page_custom_title = get_post_meta( get_the_ID(), '_upstudy_custom_page_title', true );
|
||
$page_custom_sub_title = get_post_meta( get_the_ID(), '_upstudy_custom_page_breadcrumb', true );
|
||
$page_custom_title = $page_custom_sub_title ? $page_custom_sub_title : $page_custom_title;
|
||
if ( ! $post->post_parent ) :
|
||
if ( $page_custom_title ) :
|
||
echo trim( $before ) . esc_html( $page_custom_title ) . wp_kses_post( $after );
|
||
else :
|
||
echo trim( $before ) . get_the_title() . wp_kses_post( $after );
|
||
endif;
|
||
elseif ( $post->post_parent ) :
|
||
$parent_id = $post->post_parent;
|
||
$breadcrumbs = array();
|
||
while ( $parent_id ) :
|
||
$page = get_page( $parent_id );
|
||
$breadcrumbs[] = '<li><a href="' . esc_url( get_permalink( $page->ID ) ) . '">' . esc_html( get_the_title( $page->ID ) ) . '</a></li>';
|
||
$parent_id = $page->post_parent;
|
||
endwhile;
|
||
|
||
$breadcrumbs = array_reverse($breadcrumbs);
|
||
foreach ( $breadcrumbs as $breadcrumb ) :
|
||
echo trim( $breadcrumb ) . ' ' . $spacer . ' ';
|
||
endforeach;
|
||
if ( $page_custom_title ) :
|
||
echo trim( $before ) . esc_html( $page_custom_title ) . wp_kses_post( $after );
|
||
else :
|
||
echo trim( $before ) . get_the_title() . wp_kses_post( $after );
|
||
endif;
|
||
endif;
|
||
|
||
elseif ( is_search() ) :
|
||
echo trim( $before ) . sprintf( __( 'Search results for "%s"', 'upstudy' ), get_search_query() ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_tag() ) :
|
||
echo trim( $before ) . sprintf( __( 'Posts tagged "%s"', 'upstudy' ), single_tag_title( '', false ) ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_author() ) :
|
||
global $author;
|
||
$userdata = get_userdata($author);
|
||
echo trim( $before ) . __( 'Articles posted by ', 'upstudy' ) . $userdata->display_name . wp_kses_post( $after );
|
||
|
||
elseif ( is_404() ) :
|
||
echo trim( $before ) . __( 'Error 404', 'upstudy' ) . wp_kses_post( $after );
|
||
|
||
elseif ( is_home() ) :
|
||
$posts_page_id = get_option( 'page_for_posts');
|
||
if ( $posts_page_id ) :
|
||
$label = get_the_title( $posts_page_id );
|
||
else :
|
||
$label = __( 'Blog', 'upstudy' );
|
||
endif;
|
||
echo trim( $before ) . $label . wp_kses_post( $after );
|
||
endif;
|
||
echo '</ul>';
|
||
echo '</nav>';
|
||
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 '<div id="upstudy-custom-login-wrapper" class="upstudy-login-form-popup">';
|
||
echo '<div class="upstudy-login-form-inner">';
|
||
echo '<div class="upstudy-login-popup-close"><button class="close-trigger"><i class="dt-icon-close"></i></button></div>';
|
||
echo '<div class="upstudy-login-form-content">';
|
||
echo '<div id="upstudy-login-form-wrapper" class="upstudy-login-form-wrapper">';
|
||
echo '<div class="upstudy-login-form-tab-wrapper">';
|
||
echo '<div class="upstudy-login-form-tab">';
|
||
echo '<span class="login-tab-title login-item active" data-tab-id="tab1">' . __( 'Sign in', 'upstudy' ) . '</span>';
|
||
echo '<span class="login-tab-title register-item" data-tab-id="tab2">' . __( 'Sign up', 'upstudy' ) . '</span>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-form-items">';
|
||
echo '<div class="upstudy-login-form-item login-form" id="tab1">';
|
||
echo '<div class="upstudy-login-box-text">';
|
||
echo '<h3 class="sign-in-heading">' . __( 'Sign in', 'upstudy' ) . '</h3>';
|
||
|
||
echo '<div class="upstudy-register-text">';
|
||
echo '<span class="note-for-non-account-user">';
|
||
echo __( 'Don’t have an account?', 'upstudy' );
|
||
echo '</span>';
|
||
echo '<span id="upstudy-register-form-trigger">';
|
||
echo ' ' . __( 'Sign up', 'upstudy' );
|
||
echo '</span>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
echo '<form action="' . esc_url( wp_login_url() ) . '" class="upstudy-login-form-container" method="post">';
|
||
echo '<div class="upstudy-login-item">';
|
||
echo '<input type="text" name="log" id="username" placeholder="' . __( 'Email or username', 'upstudy' ) . '" required>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-item">';
|
||
echo '<input type="password" name="pwd" id="password" placeholder="' . __( 'Password', 'upstudy' ) . '" required>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="remember-me-with-register">';
|
||
echo '<label class="forgetmenot">';
|
||
echo '<input name="rememberme" class="remember-user" type="checkbox" id="rememberme" value="forever">';
|
||
echo '<span class="remember-me-text">' . __( 'Remember me', 'upstudy' ) . '</span>';
|
||
echo '</label>';
|
||
|
||
echo '<a href=' . esc_url( wp_lostpassword_url() ) . '" class="lost_password">' . __( 'Lost your password?', 'upstudy' ) . '</a>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-register-button button-login">';
|
||
echo '<div class="upstudy-login-register-wrapper">';
|
||
echo '<input type="submit" value="' . __( 'Sign in', 'upstudy' ) . '" class="upstudy-submit-button login">';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</form>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-form-item register-form" id="tab2">';
|
||
echo '<div class="upstudy-register-box-text">';
|
||
echo '<h3 class="sign-up-heading">' . __( 'Sign up', 'upstudy' ) . '</h3>';
|
||
|
||
echo '<div class="upstudy-login-text">';
|
||
echo '<span class="note-for-account-user">';
|
||
echo __( 'Already have an account?', 'upstudy' );
|
||
echo '</span>';
|
||
echo '<span id="upstudy-login-form-trigger">';
|
||
echo ' ' . __( 'Sign in', 'upstudy' );
|
||
echo '</span>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
echo '<form action="' . esc_url( wp_registration_url() ) . '" class="upstudy-register-form-container" method="post">';
|
||
echo '<div class="upstudy-login-item">';
|
||
echo '<input type="text" name="user_login" id="reg_username" placeholder="' . __( 'Username', 'upstudy' ) . '" required>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-item">';
|
||
echo '<input type="email" name="user_email" id="reg_email" placeholder="' . __( 'Email', 'upstudy' ) . '" required>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-item">';
|
||
echo '<input type="password" name="user_pass" id="reg_password" placeholder="' . __( 'Password', 'upstudy' ) . '" required>';
|
||
echo '</div>';
|
||
|
||
do_action( 'register_form' );
|
||
|
||
echo '<div class="upstudy-login-register-button button-register">';
|
||
echo '<div class="upstudy-login-register-wrapper">';
|
||
echo '<input type="submit" value="' . __( 'Sign up', 'upstudy' ) . '" class="upstudy-submit-button register">';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</form>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-login-popup-overlay">';
|
||
}
|
||
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 '<div class="devthrow-progress-parent">';
|
||
echo '<svg class="devthrow-back-circle svg-inner" width="100%" height="100%" viewBox="-1 -1 102 102">';
|
||
echo '<path d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98" />';
|
||
echo '</svg>';
|
||
echo '</div>';
|
||
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 '<div class="upstudy-main-content-inner' . esc_attr( apply_filters( 'upstudy_main_content_inner', $layout_type ) ) . '">';
|
||
}
|
||
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 '</div>';
|
||
}
|
||
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 '<div class="upstudy-author-bio">';
|
||
echo '<div class="upstudy-author-thumb">';
|
||
echo '<a href="' . esc_url( $user_url ) . '">' . get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'upstudy_author_thumb_size', 150 ) ) . '</a>';
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-author-details">';
|
||
echo '<h5>' . esc_html( get_the_author() ) . '</h5>';
|
||
|
||
echo '<div class="upstudy-author-info">';
|
||
echo wpautop( wp_kses_post( $description ) );
|
||
echo '</div>';
|
||
|
||
echo '<div class="upstudy-editor-social-info">';
|
||
upstudy_user_social_icons( get_the_author_meta( 'ID' ) );
|
||
echo '</div>';
|
||
echo '</div>';
|
||
echo '</div>';
|
||
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' => '<nav class="upstudy-paignation"><ul class="upstudy-custom-pagination">',
|
||
'after' => '</ul></nav>',
|
||
'before_link' => '<li>',
|
||
'after_link' => '</li>',
|
||
'current_before' => '<li class="active">',
|
||
'current_after' => '</li>',
|
||
'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}</a>{$after_link}";
|
||
else :
|
||
$output .= "{$current_before}{$link_before}<span>{$j}</span>{$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' => '<i class="upstudy-pagination-icon dt-icon-left"></i>',
|
||
'next_string' => '<i class="upstudy-pagination-icon dt-icon-right"></i>',
|
||
'before_output' => '<nav class="upstudy-pagination-wrapper"><ul class="page-number">',
|
||
'after_output' => '</ul></nav>'
|
||
);
|
||
|
||
$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 ( '<li><a class="page-numbers" href="%s" title="%s">%s</a></li>', esc_url( $previous ), __( 'previous', 'upstudy' ), $args['previous_string'] );
|
||
|
||
if ( ! empty( $min ) && ! empty( $max ) ) :
|
||
for( $i = $min; $i <= $max; $i++ ) :
|
||
if ( $page == $i ) :
|
||
$echo .= sprintf ( '<li class="active"><span class="page-numbers current">%s</span></li>', esc_html( (int)$i ) );
|
||
else :
|
||
$echo .= sprintf( '<li><a class="page-numbers" href="%s">%2d</a></li>', 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 ( '<li><a class="page-numbers" href="%s" title="%s">%s</a></li>', 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'] = '<i class="upstudy-pagination-icon dt-icon-left"></i>';
|
||
$args['previous_string'] = '<i class="upstudy-pagination-icon dt-icon-right"></i>';
|
||
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 <to.ediamin@gmail.com>
|
||
* @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;
|
||
?>
|
||
<<?php echo esc_attr($tag); ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent upstudy-media upstudy-comment-item' : 'upstudy-media upstudy-comment-item' ); ?>>
|
||
|
||
<article id="comment-<?php comment_ID(); ?>" class="upstudy-single-comment <?php echo esc_attr( get_avatar($comment) ? 'upstudy-comment-has-avatar' : 'upstudy-comment-no-avatar' ); ?>">
|
||
<div class="upstudy-comment-each-item">
|
||
<?php if ( get_avatar( $comment ) && 0 != $args['avatar_size'] ): ?>
|
||
<div class="upstudy-comment-avatar">
|
||
<a href="<?php echo esc_url( esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) ); ?>" class="upstudy-media-object">
|
||
<?php echo get_avatar( $comment, $args['avatar_size'] ); ?>
|
||
</a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="upstudy-media-body">
|
||
<div class="upstudy-comment-header">
|
||
<h4 class="upstudy-media-heading">
|
||
<?php echo get_comment_author_link(); ?>
|
||
</h4>
|
||
<span class="comment-metadata">
|
||
<a class="upstudy-comment-time" href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
|
||
<time datetime="<?php esc_attr( comment_time( 'c' ) ); ?>">
|
||
<?php
|
||
printf(
|
||
__( '%1$s', 'upstudy' ), get_comment_date()
|
||
);
|
||
|
||
edit_comment_link( __( '(Edit)', 'upstudy' ), ' ', '' );
|
||
?>
|
||
</time>
|
||
</a>
|
||
</span>
|
||
</div>
|
||
|
||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||
<p class="comment-awaiting-moderation label label-info"><?php echo esc_html( $moderation_note ); ?></p>
|
||
<?php endif; ?>
|
||
|
||
<div class="comment-content">
|
||
<?php comment_text(); ?>
|
||
</div>
|
||
|
||
<div class="upstudy-comment-bottom-part">
|
||
<?php
|
||
echo get_comment_reply_link(
|
||
array(
|
||
'depth' => $depth,
|
||
'max_depth' => $args['max_depth'],
|
||
'reply_text' => sprintf( '%s', __( 'Reply', 'upstudy' ) )
|
||
),
|
||
$comment->comment_ID,
|
||
$comment->comment_post_ID
|
||
);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</article>
|
||
<?php
|
||
}
|
||
}
|
||
endif;
|
||
|
||
/**
|
||
* Custom list of comments for the theme.
|
||
*
|
||
* @since 1.0.0
|
||
*/
|
||
if ( ! function_exists( 'upstudy_comments_template' ) ) :
|
||
function upstudy_comments_template() {
|
||
$req = get_option( 'require_name_email' );
|
||
$aria_req = ( $req ? " aria-required='true'" : '' );
|
||
$args = array(
|
||
'class_form' => 'upstudy-comment-form form media-body',
|
||
'class_submit' => 'upstudy-comment-btn',
|
||
'title_reply_before' => '<h3 class="upstudy-title">',
|
||
'title_reply' => __( 'Leave a Reply', 'upstudy' ),
|
||
'label_submit' => __( 'Post A Comment', 'upstudy' ),
|
||
'title_reply_after' => '</h3>',
|
||
'must_log_in' => '<p class="must-log-in">' .
|
||
sprintf(
|
||
wp_kses(
|
||
/* translators: %s is Link to login */
|
||
__( 'You must be <a href="%s">logged in</a> to post a comment.', 'upstudy' ), array(
|
||
'a' => array(
|
||
'href' => array()
|
||
)
|
||
)
|
||
), esc_url( wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) )
|
||
) . '</p>',
|
||
'fields' =>
|
||
apply_filters(
|
||
'comment_form_default_fields', array(
|
||
|
||
'author' => '<div class="upstudy-row"><div class="upstudy-col-md-6 "><div class="form-group upstudy-comment-field label-floating is-empty"><input id="author" name="author" class="form-control" type="text"' . $aria_req . ' placeholder="' . __( 'Name', 'upstudy' ) . ( $req ? '*' : '' ) . '" /></div></div>',
|
||
|
||
'email' => '<div class="upstudy-col-md-6"><div class="form-group upstudy-comment-field label-floating is-empty"><input id="email" name="email" class="form-control" type="email"' . $aria_req . ' placeholder="' . __( 'Email', 'upstudy' ) . ( $req ? '*' : '' ) . '" /></div></div>',
|
||
|
||
'url' => '<div class="upstudy-col-lg-12"><div class="form-group upstudy-comment-field label-floating is-empty"><input id="url" name="url" class="form-control" type="url"' . $aria_req . ' placeholder="' . __( 'Website', 'upstudy' ) .'" /></div></div> </div>',
|
||
)
|
||
),
|
||
'comment_field' => '<div class="form-group upstudy-comment-field label-floating is-empty"><textarea rows="8" id="comment" name="comment" class="form-control" cols="20" aria-required="true" placeholder="' . __( 'Comment', 'upstudy' ) .'"></textarea></div>'
|
||
);
|
||
|
||
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 '<div class="comment-comment-form-hidden">';
|
||
echo str_replace( 'id="commentform"', 'id="commentform" enctype="multipart/form-data"', $form );
|
||
echo '</div>';
|
||
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 '<div class="tpc-zoom-details-page-heading">';
|
||
echo '<h3 class="title">' . wp_kses_post( get_the_title() ) . '</h3>';
|
||
echo '</div>';
|
||
}
|
||
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 '<div class="dpn-zvc-sidebar-content-list' . esc_attr( $wrapper_class ) . '">';
|
||
echo '<span class="label">';
|
||
echo esc_html($meta['label']) ? '<strong>' . esc_html( $meta['label'] ) . '</strong>' : '';
|
||
echo '</span>';
|
||
|
||
echo esc_html($meta['label']) ? ' <span class="vczapi-single-meeting-value">' . esc_html( $meta['value'] ) . '</span>' : '';
|
||
echo '</div>';
|
||
endif;
|
||
endforeach;
|
||
endif;
|
||
}
|
||
endif;
|
||
|
||
add_action( 'vczapi_html_after_meeting_details', 'upstudy_vczapi_html_after_meeting_details' );
|