> > $menu_location_second, 'menu_class' => 'menu genesis-nav-menu menu-secondary', 'container' => false, 'fallback_cb' => false, 'before' => '
  • ', 'after' => '
  • ', 'link_before' => '', 'link_after' => '', 'walker' => new Kirhero_Menu_Walker(), ); do_action( 'kirhero_nav_second' , $menu_args); } } } add_action('kirhero_header_second_menu', 'kirhero_header_second_menu'); if ( ! function_exists( 'kirhero_default_color_palettes' ) ) { function kirhero_default_color_palettes() { $palettes = array( '#000000', '#ffffff', '#dd3333', '#dd9933', '#eeee22', '#81d742', '#1e73be', '#8224e3', ); // Apply filters and return return apply_filters( 'kirhero_default_color_palettes', $palettes ); } } /** * Adds the search icon to the menu */ if ( ! function_exists( 'kirhero_add_search_to_menu' ) ) { function kirhero_add_search_to_menu( $items, $args ) { // Only used on main menu if ( 'main_menu' != $args->theme_location ) { return $items; } //if disable if( ! get_theme_mod( 'kirhero_header_search_header_show', kirhero_get_default_theme_settings( 'header-menu-search-show' ) ) ) { return $items; } $items .= ''; // Return nav $items return $items; } add_filter( 'wp_nav_menu_items', 'kirhero_add_search_to_menu', 11, 2 ); } if ( ! function_exists( 'kirhero_customizer_layout_blog' ) ) { function kirhero_customizer_layout_blog() { $layouts = array( 'content-sidebar' => get_template_directory_uri() . '/inc/customizer/assets/img/rs.png', 'sidebar-content' => get_template_directory_uri() . '/inc/customizer/assets/img/ls.png', 'full-width-content' => get_template_directory_uri() . '/inc/customizer/assets/img/fw.png', 'both-sidebars' => get_template_directory_uri() . '/inc/customizer/assets/img/bs.png', ); return $layouts; } } if ( ! function_exists( 'kirhero_get_sidebar' ) ) { function kirhero_get_sidebar( $sidebar = 'sidebar-primary' ) { // Add filter for tweaking the sidebar display via child theme's $sidebar = apply_filters( 'kirhero_get_sidebar', $sidebar ); // Never show empty sidebar if ( ! is_active_sidebar( $sidebar ) ) { $sidebar = 'sidebar-primary'; } // Return the correct sidebar return $sidebar; } } /** * Returns the correct second sidebar ID * * @since 1.4.0 */ if ( ! function_exists( 'kirhero_get_second_sidebar' ) ) { function kirhero_get_second_sidebar( $sidebar = 'sidebar-primary-left' ) { // Add filter for tweaking the left sidebar display via child theme's $sidebar = apply_filters( 'kirhero_get_second_sidebar', $sidebar ); // Never show empty sidebar if ( ! is_active_sidebar( $sidebar ) ) { $sidebar = 'sidebar-primary-left'; } // Return the correct sidebar return $sidebar; } } if ( ! function_exists( 'kirhero_display_sidebar' ) ) { function kirhero_display_sidebar() { //Retunr if full width or full screen if ( in_array( kirhero_layout(), array( 'full-screen', 'full-width-content' ) ) ) { return; } // Add the default sidebar get_sidebar( ); } add_action( 'kirhero_display_sidebar', 'kirhero_display_sidebar' ); } if ( ! function_exists( 'kirhero_display_sidebar_left' ) ) { function kirhero_display_sidebar_left() { // Retunr if full width or full screen if ( in_array( kirhero_layout(), array( 'full-screen', 'full-width-content' ) ) ) { return; } //Add the second sidebar if ( 'both-sidebars' == kirhero_layout() ) { get_sidebar( 'left' ); } } add_action( 'kirhero_display_sidebar_left', 'kirhero_display_sidebar_left' ); } if ( ! function_exists( 'kirhero_layout' ) ) { function kirhero_layout() { $class = 'content-sidebar'; $meta = get_post_meta( kirhero_post_id(), 'kirhero_post_layout', true ); if ( $meta ) { return $meta; } // Singular Page if ( is_page() ) { // Landing template if ( is_page_template( 'templates/landing.php' ) ) { $class = 'full-width-content'; } // Landing template elseif ( is_page_template( 'templates/homepage.php' ) ) { $class = 'full-width-content'; } // Landing template elseif ( is_page_template( 'templates/landingpage.php' ) ) { $class = 'full-width-content'; } // Attachment elseif ( is_attachment() ) { $class = 'full-width-content'; } // All other pages else { $class = get_theme_mod( 'kirhero_admin_general_pages_layout', kirhero_get_default_theme_settings( 'general-pages-layout' ) ); } } // Home elseif ( is_home() || is_category() || is_tag() || is_date() || is_author() ) { $class = get_theme_mod( 'kirhero_admin_blog_layout', kirhero_get_default_theme_settings('blog-customizer-layout') ); } // Singular Post elseif ( is_singular( 'post' ) ) { $class = get_theme_mod( 'kirhero_blog_single_layout', kirhero_get_default_theme_settings( 'blog-customizer-single-layout' ) ); } // Library and Elementor template elseif ( is_singular( 'elementor_library' ) ) { $class = 'full-width-content'; } // Search elseif ( is_search() ) { $class = get_theme_mod( 'kirhero_admin_general_pages_layout', kirhero_get_default_theme_settings( 'general-pages-layout' ) ); } //attachment elseif ( is_attachment() ) { $class = 'full-width-content'; } // 404 page elseif ( is_404() ) { $class = 'full-width-content' ; } // All else else { $class = 'content-sidebar'; } if ( empty( $class ) ) { $class = 'content-sidebar'; } // Apply filters and return return apply_filters( 'kirhero_layout_class', $class ); } } if ( ! function_exists( 'kirhero_blog_grid_columns' ) ) { function kirhero_blog_grid_columns() { // Get columns from customizer setting $columns = get_theme_mod( 'kirhero_admin_blog_style_grid', kirhero_get_default_theme_settings( 'blog-style-grid' ) ); // Sanitize $columns = $columns ? $columns : '2'; // Apply filters for child theming $columns = apply_filters( 'kirhero_blog_entry_columns', $columns ); // Return columns return $columns; } } if ( ! function_exists( 'kirhero_frontpage_team_grid' ) ) { function kirhero_frontpage_team_grid() { // Get columns from customizer setting $columns = get_theme_mod( 'kirhero_admin_frontpage_team_section_items_count', kirhero_get_default_theme_settings( 'frontpage-team-items-count' ) ); // Sanitize $columns = $columns ? $columns : '2'; // Apply filters for child theming $columns = apply_filters( 'kirhero_frontpage_team_grid', $columns ); // Return columns return $columns; } } if ( ! function_exists( 'kirhero_frontpage_features_grid' ) ) { function kirhero_frontpage_features_grid() { // Get columns from customizer setting $columns = get_theme_mod( 'kirhero_admin_frontpage_features_section_items_count', kirhero_get_default_theme_settings( 'frontpage-features-items-count' ) ); // Sanitize $columns = $columns ? $columns : '2'; // Apply filters for child theming $columns = apply_filters( 'kirhero_frontpage_features_grid', $columns ); // Return columns return $columns; } } if ( ! function_exists( 'kirhero_header_content_calc' ) ) { //cacl fixed header +content + padding + margin function kirhero_header_content_calc() { if( !is_page_template( 'templates/landing.php' ) ) { $header_fixed = get_theme_mod( 'kirhero_header_fixed', kirhero_get_default_theme_settings('header-fixed')); $header_transarent = get_theme_mod( 'kirhero_header_transparent_hp', kirhero_get_default_theme_settings('header-transparent-hp')); $height = 0; //if elementr not exist in future !!! if ( $header_fixed == TRUE or $header_transarent == TRUE) { $header_height = get_theme_mod( 'kirhero_admin_header_height', kirhero_get_default_theme_settings('header-height') ); $header_padding_bottom = get_theme_mod( 'kirhero_header_padding_bottom', kirhero_get_default_theme_settings('header-padding-bottom') ); $header_padding_top = get_theme_mod( 'kirhero_header_padding_top', kirhero_get_default_theme_settings('header-padding-top') ); $header_margin_top = get_theme_mod( 'kirhero_header_margin_top', kirhero_get_default_theme_settings('header-margin-top') ); //check all and default setting padding (etc 20px) $height += $header_height + $header_padding_bottom + $header_padding_top + $header_margin_top; if($height < 59) { $height += 60; } } } else { $height = 0; } return $height; } } /** * Returns blog article elements positioning */ if ( ! function_exists( 'kirhero_blog_article_elements_positioning' ) ) { function kirhero_blog_article_elements_positioning() { // Get sections from Customizer $sections = get_theme_mod( 'kirhero_blog_article_elements_positioning', kirhero_get_default_theme_settings('blog-article-elements-positioning') ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'kirhero_blog_article_elements_positioning', $sections ); // Return sections return $sections; } } if ( ! function_exists( 'kirhero_blog_article_meta' ) ) { function kirhero_blog_article_meta() { // Get sections from Customizer $sections = get_theme_mod( 'kirhero_blog_article_meta', kirhero_get_default_theme_settings('blog-article-meta') ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'kirhero_blog_article_meta', $sections ); // Return sections return $sections; } } /** * Returns Frontpage elements positioning */ if ( ! function_exists( 'kirhero_frontpage_elements_positioning' ) ) { function kirhero_frontpage_elements_positioning() { // Get sections from Customizer $sections = get_theme_mod( 'kirhero_admin_frontpage_elements_positioning', kirhero_get_default_theme_settings('frontpage-elements-positioning') ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'kirhero_frontpage_elements_positioning', $sections ); // Return sections return $sections; } } if ( ! function_exists( 'kirhero_article_length' ) ) { function kirhero_article_length( $length = 30 ) { global $post; // Check for custom excerpt if ( has_excerpt( $post->ID ) ) { $output = $post->post_excerpt; } // No custom excerpt else { // Check for more tag and return content if it exists if ( strpos( $post->post_content, '' ) ) { $output = apply_filters( 'the_content', get_the_content() ); } // No more tag defined else { $output = wp_trim_words( strip_shortcodes( $post->post_content ), $length ); } } return $output; } } if ( ! function_exists( 'kirhero_get_post_audio_html' ) ) { function kirhero_get_post_audio_html( $audio = '' ) { // Get audio $audio = $audio ? $audio : kirhero_get_post_media(); // Return if audio is empty if ( empty( $audio ) ) { return; } // Check post format for standard post type if ( 'post' == get_post_type() && 'audio' != get_post_format() ) { return; } // Get oembed code and return if ( ! is_wp_error( $oembed = wp_oembed_get( $audio ) ) && $oembed ) { return '
    '. $oembed .'
    '; } // Display using apply_filters if it's self-hosted else { $audio = apply_filters( 'the_content', $audio ); // Add responsive audio wrap for youtube/vimeo embeds if ( strpos( $audio, 'youtube' ) || strpos( $audio, 'vimeo' ) ) { return '
    '. $audio .'
    '; } // Else return without responsive wrap else { return $audio; } } } } if ( ! function_exists( 'kirhero_get_post_video_html' ) ) { function kirhero_get_post_video_html( $video = '' ) { // Get video $video = $video ? $video : kirhero_get_post_media(); // Return if video is empty if ( empty( $video ) ) { return; } // Check post format for standard post type if ( 'post' == get_post_type() && 'video' != get_post_format() ) { return; } // Get oembed code and return if ( ! is_wp_error( $oembed = wp_oembed_get( $video ) ) && $oembed ) { return '
    '. $oembed .'
    '; } // Display using apply_filters if it's self-hosted else { $video = apply_filters( 'the_content', $video ); // Add responsive video wrap for youtube/vimeo embeds if ( strpos( $video, 'youtube' ) || strpos( $video, 'vimeo' ) ) { return '
    '. $video .'
    '; } // Else return without responsive wrap else { return $video; } } } } if ( ! function_exists( 'kirhero_get_post_media' ) ) { function kirhero_get_post_media( $post_id = '' ) { // Define video variable $video = ''; // Get correct ID $post_id = $post_id ? $post_id : get_the_ID(); // Embed if ( $meta = get_post_meta( $post_id, 'kirhero_post_video_embed', true ) ) { $video = $meta; } // Check for self-hosted first elseif ( $meta = get_post_meta( $post_id, 'kithero_post_self_hosted_media', true ) ) { $video = $meta; } // Check for post oembed elseif ( $meta = get_post_meta( $post_id, 'kirhero_post_oembed', true ) ) { $video = $meta; } // Apply filters for child theming $video = apply_filters( 'kirhero_get_post_video', $video ); // Return data return $video; } } if ( ! function_exists( 'kirhero_blog_article_style' ) ) { function kirhero_blog_article_style() { // Get default style from Customizer $style = get_theme_mod( 'kirhero_admin_blog_style', kirhero_get_default_theme_settings( 'blog-style' ) ); // Sanitize $style = $style ? $style : 'large-entry'; // Apply filters for child theming $style = apply_filters( 'kirhero_blog_entry_style', $style ); // Return style return $style; } } if ( ! function_exists( 'kirhero_blog_article_images_size' ) ) { function kirhero_blog_article_images_size() { // Get default size from Customizer $size = get_theme_mod( 'kirhero_blog_image_size', kirhero_get_default_theme_settings( 'blog-article-image-size' ) ); // Sanitize $size = $size ? $size : 'full'; // Apply filters for child theming $size = apply_filters( 'kirhero_blog_article_images_size', $size ); // Return size return $size; } } if ( ! function_exists( 'kirhero_blog_pagination' ) ) { function kirhero_blog_pagination() { kirhero_pagination(); } } // Pagination Number if ( ! function_exists( 'kirhero_pagination') ) { function kirhero_pagination( $query = '', $echo = true ) { // Arrows with RTL support $prev_arrow = is_rtl() ? 'fa fa-angle-right' : 'fa fa-angle-left'; $next_arrow = is_rtl() ? 'fa fa-angle-left' : 'fa fa-angle-right'; // Get global $query if ( ! $query ) { global $wp_query; $query = $wp_query; } // Set vars $total = $query->max_num_pages; $big = 999999999; // Display pagination if total var is greater then 1 ( current query is paginated ) if ( $total > 1 ) { // Get current page if ( $current_page = get_query_var( 'paged' ) ) { $current_page = $current_page; } elseif ( $current_page = get_query_var( 'page' ) ) { $current_page = $current_page; } else { $current_page = 1; } // Get permalink structure if ( get_option( 'permalink_structure' ) ) { if ( is_page() ) { $format = 'page/%#%/'; } else { $format = '/%#%/'; } } else { $format = '&paged=%#%'; } $args = apply_filters( 'kirhero_pagination_args', array( 'base' => str_replace( $big, '%#%', html_entity_decode( get_pagenum_link( $big ) ) ), 'format' => $format, 'current' => max( 1, $current_page ), 'total' => $total, 'mid_size' => 3, 'type' => 'list', 'prev_text' => '', 'next_text' => '', ) ); // Output pagination if ( $echo ) { echo ''; } else { return ''; } } } } //add custom article per page add_action( 'pre_get_posts', 'kirhero_no_limit_posts' ); function kirhero_no_limit_posts( $query ) { if( $query->is_main_query() && !is_admin() && is_home() ) { //$query->set( 'posts_per_page', '3' ); } } if ( ! function_exists( 'kirhero_blog_single_elements_positioning' ) ) { function kirhero_blog_single_elements_positioning() { // Get sections from Customizer $sections = get_theme_mod( 'kirhero_blog_single_elements_positioning', kirhero_get_default_theme_settings( 'blog-page-single-elements-positioning' ) ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'kirhero_blog_single_elements_positioning', $sections ); // Return sections return $sections; } } if ( ! function_exists( 'kirhero_get_sub_menu' ) ) { function kirhero_get_sub_menu() { //check if enable not hidden //for all $style_blog_all = $style_blog_single = get_theme_mod( 'kirhero_general_page_header_style', kirhero_get_default_theme_settings( 'blog-general-header-style' ) ); //for blog single page $style_blog_single = get_theme_mod( 'kirhero_blog_page_header_style', kirhero_get_default_theme_settings( 'blog-page-header-style' ) ); if( $style_blog_single !== 'hidden' && is_singular( 'post' ) ) { get_template_part( 'template-parts/subheader/single' ); } else if ( $style_blog_all !== 'hidden' && !is_singular( 'post' ) ) { //for all get_template_part( 'template-parts/subheader/all' ); } } add_action( 'kirhero_get_sub_menu', 'kirhero_get_sub_menu'); } if ( ! function_exists( 'kirhero_sub_menu_single_header_style' ) ) { function kirhero_sub_menu_single_header_style() { $style = get_theme_mod( 'kirhero_blog_page_header_style', kirhero_get_default_theme_settings( 'blog-page-header-style' ) ); // Sanitize data $style = ( 'default' == $style ) ? '' : $style; // Apply filters and return return apply_filters( 'kirhero_sub_menu_single_header_style', $style ); } } if ( ! function_exists( 'kirhero_sub_menu_general_header_style' ) ) { function kirhero_sub_menu_general_header_style() { $style = get_theme_mod( 'kirhero_general_page_header_style', kirhero_get_default_theme_settings( 'general-page-header-style' ) ); // Sanitize data $style = ( 'default' == $style ) ? '' : $style; // Apply filters and return return apply_filters( 'kirhero_sub_menu_general_header_style', $style ); } } if ( ! function_exists( 'kirhero_post_id' ) ) { function kirhero_post_id() { // Default value $id = ''; // If singular get_the_ID if ( is_singular() ) { $id = get_the_ID(); } // Get ID of WooCommerce product archive elseif ( KIRHERO_WOOCOMMERCE_ACTIVE && is_shop() ) { $shop_id = wc_get_page_id( 'shop' ); if ( isset( $shop_id ) ) { $id = $shop_id; } } // Posts page elseif ( is_home() && $page_for_posts = get_option( 'page_for_posts' ) ) { $id = $page_for_posts; } // Apply filters $id = apply_filters( 'kirhero_post_id', $id ); // Sanitize $id = $id ? $id : ''; // Return ID return $id; } } if ( ! function_exists( 'kirhero_title' ) ) { function kirhero_title() { // Default title is null $title = NULL; // Get post ID $post_id = kirhero_post_id(); // Homepage - display blog description if not a static page if ( is_front_page() && ! is_singular( 'page' ) ) { if ( get_bloginfo( 'description' ) ) { $title = get_bloginfo( 'description' ); } else { return esc_html__( 'Recent Posts', 'astori' ); } // Homepage posts page } elseif ( is_home() && ! is_singular( 'page' ) ) { $title = get_the_title( get_option( 'page_for_posts', true ) ); } // Search needs to go before archives elseif ( is_search() ) { global $wp_query; $title = ''. $wp_query->found_posts .' '. esc_html__( 'Search Results Found', 'astori' ); } // Archives elseif ( is_archive() ) { // Author if ( is_author() ) { $title = get_the_archive_title(); } // Post Type archive title elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } // Daily archive title elseif ( is_day() ) { /* translators: %s: Daily Archives */ $title = sprintf( esc_html__( 'Daily Archives: %s', 'astori' ), get_the_date() ); } // Monthly archive title elseif ( is_month() ) { /* translators: %s: Monthly Archives */ $title = sprintf( esc_html__( 'Monthly Archives: %s', 'astori' ), get_the_date( esc_html_x( 'F Y', 'Page title monthly archives date format', 'astori' ) ) ); } // Yearly archive title elseif ( is_year() ) { /* translators: %s: Yearly Archives */ $title = sprintf( esc_html__( 'Yearly Archives: %s', 'astori' ), get_the_date( esc_html_x( 'Y', 'Page title yearly archives date format', 'astori' ) ) ); } // Categories/Tags/Other else { // Get term title $title = single_term_title( '', false ); // Fix for plugins that are archives but use pages if ( ! $title ) { global $post; $title = get_the_title( $post_id ); } } } // End is archive check // 404 Page elseif ( is_404() ) { $title = esc_html__( '404: Page Not Found', 'astori' ); } // Anything else with a post_id defined elseif ( $post_id ) { // Single Pages if ( is_singular( 'page' ) || is_singular( 'attachment' ) ) { $title = get_the_title( $post_id ); } // Single blog posts elseif ( is_singular( 'post' ) ) { //page title or blog /* if ( 'post-title' == get_theme_mod( 'kirhero_blog_single_page_header_title', 'blog' ) ) { $title = get_the_title(); } else { $title = esc_html__( 'Blog', 'astori' ); } */ $title = get_the_title(); } // Other posts else { $title = get_the_title( $post_id ); } } // Last check if title is empty $title = $title ? $title : get_the_title(); // Apply filters and return title return apply_filters( 'kirhero_title', $title ); } } if ( ! function_exists( 'kirhero_get_page_subheading' ) ) { function kirhero_get_page_subheading() { $subheading = NULL; // Search if ( is_search() ) { $subheading = esc_html__( 'You searched for:', 'astori' ) .' "'. esc_html( get_search_query( false ) ) .'"'; } // Author elseif ( is_author() ) { $subheading = esc_html__( 'This author has written', 'astori' ) .' '. get_the_author_posts() .' '. esc_html__( 'articles', 'astori' ); } // Archives elseif ( is_post_type_archive() ) { $subheading = get_the_archive_description(); } // All other Taxonomies elseif ( is_category() || is_tax() ) { $subheading = term_description(); } // Apply filters and return return apply_filters( 'kirhero_get_page_subheading', $subheading ); } } if ( ! function_exists( 'kirhero_has_single_breadcrumbs' ) ) { function kirhero_has_single_breadcrumbs() { $return = get_theme_mod( 'kirhero_blog_subheader_breadcrumbs', kirhero_get_default_theme_settings('blog-page-header-enable-breadcrumbs') ); // Apply filters and return return apply_filters( 'kirhero_has_single_breadcrumbs', $return ); } } if ( ! function_exists( 'kirhero_has_all_breadcrumbs' ) ) { function kirhero_has_all_breadcrumbs() { $return = get_theme_mod( 'kirhero_general_subheader_breadcrumbs', kirhero_get_default_theme_settings('general-page-header-enable-breadcrumbs') ); // Apply filters and return return apply_filters( 'kirhero_has_all_breadcrumbs', $return ); } } function kirhero_all_breadcrumb( $args = array() ) { // Return if breadcrumbs are disabled if ( ! kirhero_has_all_breadcrumbs() || is_front_page() ) { return; } // Yoast breadcrumbs if ( function_exists( 'yoast_breadcrumb' ) ) { } $breadcrumb = apply_filters( 'breadcrumb_trail_object', null, $args ); if ( !is_object( $breadcrumb ) ) { $breadcrumb = new Kirhero_Breadcrumb( $args ); } return $breadcrumb->trail(); } function kirhero_breadcrumb( $args = array() ) { // Return if breadcrumbs are disabled if ( ! kirhero_has_single_breadcrumbs() || is_front_page() ) { return; } // Yoast breadcrumbs if ( function_exists( 'yoast_breadcrumb' ) ) { } $breadcrumb = apply_filters( 'breadcrumb_trail_object', null, $args ); if ( !is_object( $breadcrumb ) ) { $breadcrumb = new Kirhero_Breadcrumb( $args ); } return $breadcrumb->trail(); } if ( ! function_exists( 'kirhero_blog_single_meta' ) ) { function kirhero_blog_single_meta () { // Default sections $sections = get_theme_mod( 'kirhero_blog_single_meta', kirhero_get_default_theme_settings( 'blog-page-single-meta' ) ); // Turn into array if string if ( $sections && ! is_array( $sections ) ) { $sections = explode( ',', $sections ); } // Apply filters for easy modification $sections = apply_filters( 'kirhero_blog_single_meta', $sections ); // Return sections return $sections; } } if ( ! function_exists( 'kirhero_top_future' ) ) { function kirhero_top_future () { $return = false; $future = get_theme_mod( 'kirhero_blog_page_featured_image_style', kirhero_get_default_theme_settings( 'blog-page-single-featured-style' ) ); if( $future == 'page-banner') { $return = true; } return $return; } } // content and sidebara width % if ( ! function_exists( 'kirhero_content_width_left_sidebar' ) ) { function kirhero_content_width_left_sidebar () { //get content width $content_width = get_theme_mod( 'kirhero_admin_general_layout_content_width', kirhero_get_default_theme_settings('general-layout-content-width') ); $widget_has = false; //check if widget exist (left) if ( 'both-sidebars' == kirhero_layout() ) { $widget_has = true; } if( $widget_has ) { //get widget width from customizer $widget_width = get_theme_mod( 'kirhero_admin_general_layout_sidebar_left_width', kirhero_get_default_theme_settings('general-layout-left-width') ); } //process //if only one widget acctive if( $widget_has ) { $content_width = 100 - $widget_width; } return $content_width; } } if ( ! function_exists( 'kirhero_love' ) ) { function kirhero_love () { if (! did_action('kirhero_footer')) { do_action('kirhero_footer'); } } add_action('kirhero_love', 'kirhero_love'); } // content and sidebara right width % if ( ! function_exists( 'kirhero_content_width_right_sidebar' ) ) { function kirhero_content_width_right_sidebar () { //get content width $content_width = get_theme_mod( 'kirhero_admin_general_layout_content_width', kirhero_get_default_theme_settings('general-layout-content-width') ); $widget_has = true; // Retunr if full width or full screen if ( in_array( kirhero_layout(), array( 'full-screen', 'full-width-content' ) ) ) { $widget_has = false; } if( $widget_has ) { //get widget width from customizer $widget_width = get_theme_mod( 'kirhero_admin_general_layout_sidebar_right_width', kirhero_get_default_theme_settings('general-layout-right-width') ); } //process //if only one widget acctive if( $widget_has ) { $content_width = 100 - $widget_width; } return $content_width; } } // content and sidebara right width % if ( ! function_exists( 'kirhero_admin_not_empty' ) ) { function kirhero_admin_not_empty ($what , $where) { $return = false; if( !empty( $what ) && $what !== $where ) { $return = true; } return $return; } } if ( ! function_exists( 'kirhero_footer' ) ) { function kirhero_footer () { echo ' | '; echo 'WordPress Theme by Themesinfo'; } add_action('kirhero_footer', 'kirhero_footer'); } if ( ! function_exists( 'kirhero_copyright' ) ) { function kirhero_copyright () { //get from customizer $text = get_theme_mod( 'kirhero_admin_footer_text', kirhero_get_default_theme_settings('footer-text') ); return apply_filters( 'kirhero_copyright', $text ); } } if ( ! function_exists( 'kirhero_schema_markup' ) ) { function kirhero_schema_markup( $location ) { // Return if disable //if ( ! get_theme_mod( 'ocean_schema_markup', true ) ) { // return null; //} // Default $schema = $itemprop = $itemtype = ''; // HTML if ( 'html' == $location ) { if ( is_singular() ) { $schema = 'itemscope itemtype="http://schema.org/WebPage"'; } else { $schema = 'itemscope itemtype="http://schema.org/Article"'; } } // Header elseif ( 'header' == $location ) { $schema = 'itemscope="itemscope" itemtype="http://schema.org/WPHeader"'; } // Logo elseif ( 'logo' == $location ) { $schema = 'itemscope itemtype="http://schema.org/Brand"'; } // Navigation elseif ( 'site_navigation' == $location ) { $schema = 'itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"'; } // Main elseif ( 'main' == $location ) { $itemtype = 'http://schema.org/WebPageElement'; $itemprop = 'mainContentOfPage'; if ( is_singular( 'post' ) ) { $itemprop = ''; $itemtype = 'http://schema.org/Blog'; } } // Breadcrumb elseif ( 'breadcrumb' == $location ) { $schema = 'itemscope itemtype="http://schema.org/BreadcrumbList"'; } // Breadcrumb list elseif ( 'breadcrumb_list' == $location ) { $schema = 'itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"'; } // Breadcrumb itemprop elseif ( 'breadcrumb_itemprop' == $location ) { $schema = 'itemprop="breadcrumb"'; } // Sidebar elseif ( 'sidebar' == $location ) { $schema = 'itemscope="itemscope" itemtype="http://schema.org/WPSideBar"'; } // Footer widgets elseif ( 'footer' == $location ) { $schema = 'itemscope="itemscope" itemtype="http://schema.org/WPFooter"'; } // Headings elseif ( 'headline' == $location ) { $schema = 'itemprop="headline"'; } // Posts elseif ( 'entry_content' == $location ) { $schema = 'itemprop="text"'; } // Publish date elseif ( 'publish_date' == $location ) { $schema = 'itemprop="datePublished" pubdate'; } // Author name elseif ( 'author_name' == $location ) { $schema = 'itemprop="name"'; } // Author link elseif ( 'author_link' == $location ) { $schema = 'itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person"'; } // Url elseif ( 'url' == $location ) { $schema = 'itemprop="url"'; } // Position elseif ( 'position' == $location ) { $schema = 'itemprop="position"'; } // Image elseif ( 'image' == $location ) { $schema = 'itemprop="image"'; } return ' ' . apply_filters( 'kirhero_schema_markup', $schema ); } } if ( ! function_exists( 'kirhero_schema_markup_echo' ) ) { function kirhero_schema_markup_echo( $location ) { echo wp_kses_post( kirhero_schema_markup( $location )); } } /* Widget */ if ( ! function_exists( 'kirhero_home_page_slider_widget' ) ) { function kirhero_home_page_slider_widget( $location ) { // Do not display the front pages sidebar areas when the Page Builder Template is activated if ( is_front_page() && ! is_page_template( 'page-templates/page-builder.php' ) ) { if ( is_active_sidebar( 'home-page-below-header' ) ) { if ( ! dynamic_sidebar( 'home-page-below-header' ) ): endif; } } } add_action( 'kirhero_home_page_slider_widget', 'kirhero_home_page_slider_widget'); } if ( ! function_exists( 'kirhero_search_form' ) ) { add_filter('get_search_form', 'kirhero_search_form'); function kirhero_search_form($html) { $html = ''; return $html; } } if ( ! function_exists( 'kirhero_footer_widgets' ) ) { function kirhero_footer_widgets() { $widgets_count = get_theme_mod( 'kirhero_admin_footer_widgets_count', kirhero_get_default_theme_settings( 'footer-widgets-count' ) ); if( empty( $widgets_count ) or $widgets_count == 0 or !(int) $widgets_count) { return; } $footer_sidebars_array = array( 'kirhero-footer-one', 'kirhero-footer-two', 'kirhero-footer-three' ); $footer_sidebars_array = array_slice( $footer_sidebars_array, 0, $widgets_count ); //get class grid $counter = 0; $css_widgets = ''; if( $widgets_count == 1 ) { $css_widgets = 'one-one-one'; } else if( $widgets_count == 2 ) { $css_widgets = 'one-half'; } else if( $widgets_count == 3 ) { $css_widgets = 'one-third'; } echo "
    "; foreach ( $footer_sidebars_array as $footer_sidebar ) { $css_first = ''; $counter++; if ( $counter == 1 && $widgets_count > 1) { $css_first = ' first'; } if ( is_active_sidebar( $footer_sidebar ) ) { echo '
    '; dynamic_sidebar( $footer_sidebar ); echo '
    '; } } echo "
    "; echo "
    "; } add_action( 'kirhero_footer_widgets', 'kirhero_footer_widgets'); } /////////////// ////////////////////////////////////////////////////////////////