' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) ); } } /** * Schema for tag. */ if ( ! function_exists( 'bstone_schema_body' ) ) : /** * Adds schema tags to the body classes. * * @since 1.0.0 */ function bstone_schema_body() { // Check conditions. $is_blog = ( is_home() || is_archive() || is_attachment() || is_tax() || is_single() ) ? true : false; // Set up default itemtype. $itemtype = 'WebPage'; // Get itemtype for the blog. $itemtype = ( $is_blog ) ? 'Blog' : $itemtype; // Get itemtype for search results. $itemtype = ( is_search() ) ? 'SearchResultsPage' : $itemtype; // Get the result. $result = apply_filters( 'bstone_schema_body_itemtype', $itemtype ); // Return our HTML. echo apply_filters( 'bstone_schema_body', "itemtype='http://schema.org/" . esc_html( $result ) . "' itemscope='itemscope'" ); } endif; /** * Function to get site Header */ if ( ! function_exists( 'bstone_header_markup' ) ) { /** * Site Header -
* * @since 1.0.0 */ function bstone_header_markup() { ?>
role="banner">
'; } else { $submenu_class = apply_filters( 'primary_submenu_border_class', ' submenu-with-border' ); // Primary Menu. $primary_menu_args = array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'main-header-menu st-flex st-justify-content-flex-end' . $submenu_class, 'container' => 'div', 'container_class' => 'st-main-navigation', ); // Fallback Menu if primary menu not set. $fallback_menu_args = array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'st-main-navigation', 'container' => 'div', 'before' => '', ); ?>
'; $html .= get_custom_logo(); $html .= ''; if ( apply_filters( 'bstone_replace_logo_width', true ) ) { remove_filter( 'wp_get_attachment_image_src', 'bstone_replace_header_logo', 10 ); remove_filter( 'wp_get_attachment_image_attributes', 'bstone_replace_header_attr', 10 ); } } if ( ! apply_filters( 'bstone_disable_site_identity', false ) ) { // Site Title. if ( $display_site_tagline ) { $tag = 'span'; if ( is_home() || is_front_page() ) { $tag = 'h1'; } $html .= '<' . $tag . ' itemprop="name" class="site-title"> '; } // Site description. if ( $site_tagline ) { $html .= '

' . get_bloginfo( 'description' ) . '

'; } } $html = apply_filters( 'bstone_logo', $html, $display_site_tagline, $site_tagline ); /** * Echo or Return the Logo Markup */ if ( $echo ) { echo $html; } else { return $html; } } }// End if(). /** * Replace heade logo. */ if ( ! function_exists( 'bstone_replace_header_logo' ) ) : /** * Replace header logo. * * @param array $image Size. * @param int $attachment_id Image id. * @param sting $size Size name. * @param string $icon Icon. * * @return array Size of image */ function bstone_replace_header_logo( $image, $attachment_id, $size, $icon ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( ! is_customize_preview() && $custom_logo_id == $attachment_id && 'full' == $size ) { $data = wp_get_attachment_image_src( $attachment_id, 'bst-logo-size' ); if ( false != $data ) { $image = $data; } } return $image; } endif; // End if(). /** * Function to check if it is Internet Explorer */ if ( ! function_exists( 'bstone_replace_header_attr' ) ) : /** * Replace header logo. * * @param array $attr Image. * @param object $attachment Image obj. * @param sting $size Size name. * * @return array Image attr. */ function bstone_replace_header_attr( $attr, $attachment, $size ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id == $attachment->ID ) { if ( ! is_customize_preview() ) { $attach_data = wp_get_attachment_image_src( $attachment->ID, 'bst-logo-size' ); if ( isset( $attach_data[0] ) ) { $attr['src'] = $attach_data[0]; } } $retina_logo = bstone_get_option( 'bst-header-retina-logo' ); $attr['srcset'] = ''; if ( apply_filters( 'bstone_main_header_retina', true ) && '' !== $retina_logo ) { $cutom_logo = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $cutom_logo_url = $cutom_logo[0]; if ( bstone_check_is_ie() ) { // Replace header logo url to retina logo url. $attr['src'] = $retina_logo; } $attr['srcset'] = $cutom_logo_url . ' 1x, ' . $retina_logo . ' 2x'; } } return $attr; } endif; // End if(). /** * Function to get Toggle Button Markup */ if ( ! function_exists( 'bstone_toggle_buttons_markup' ) ) { /** * Toggle Button Markup * * @since 1.0.0 */ function bstone_toggle_buttons_markup() { $disable_primary_navigation = bstone_options( 'disable-primary-nav' ); $custom_header_rt_section = bstone_options( 'header-main-rt-section' ); $custom_header_lt_section = bstone_options( 'header-main-lt-section' ); $bst_header_type = bstone_options( 'header-layouts' ); $menu_bottons = true; if( 'header-main-layout-1' == $bst_header_type && $disable_primary_navigation && 'none' == $custom_header_rt_section ) { $menu_bottons = false; } if ( 'header-main-layout-2' == $bst_header_type && $disable_primary_navigation && 'none' == $custom_header_rt_section && 'none' == $custom_header_lt_section ) { $menu_bottons = false; } if ( apply_filters( 'bstone_enable_mobile_menu_buttons', $menu_bottons ) ) { ?>
' . esc_html__( 'Search', 'bstone' ) . '
'; return apply_filters( 'bstone_get_search', $search_html ); } } /** * Get custom HTML added by user. */ if ( ! function_exists( 'bstone_get_custom_html' ) ) { function bstone_get_custom_html( $option_name = '' ) { $custom_html = ''; $custom_html_content = bstone_options( $option_name ); if ( ! empty( $custom_html_content ) ) { $custom_html = '
' . do_shortcode( $custom_html_content ) . '
'; } elseif ( current_user_can( 'edit_theme_options' ) ) { $custom_html = '' . __( 'Add Custom HTML', 'bstone' ) . ''; } return $custom_html; } } /** * Get Widget added by user. */ if ( ! function_exists( 'bstone_get_custom_widget' ) ) { function bstone_get_custom_widget( $option_name = '' ) { ob_start(); if ( 'header-main-rt-section' == $option_name ) { $widget_id = 'header-widget-1'; } else if ( 'header-main-rt-section-2' == $option_name ) { $widget_id = 'header-widget-2'; } echo '
'; bstone_get_sidebar( $widget_id ); echo '
'; return ob_get_clean(); } } /** * Display Sidebars */ if ( ! function_exists( 'bstone_get_sidebar' ) ) { /** * Get Sidebar * * @since 1.0.0 * @param string $sidebar_id Sidebar Id. * @return void */ function bstone_get_sidebar( $sidebar_id ) { if ( is_active_sidebar( $sidebar_id ) ) { dynamic_sidebar( $sidebar_id ); } elseif ( current_user_can( 'edit_theme_options' ) ) { ?>

'>

'>

* * @since 1.0.0 */ function bstone_footer_markup() { ?> "; the_posts_pagination( array( 'prev_text' => bstone_get_option( 'pagination-text-prev' ), 'next_text' => bstone_get_option( 'pagination-text-next' ), ) ); echo ''; $output = ob_get_clean(); echo apply_filters( 'bstone_pagination_markup', $output ); // WPCS: XSS OK. } } }// End if(). add_action( 'bstone_pagination', 'bstone_number_pagination' ); /** * Bstone entry header class. */ if ( ! function_exists( 'bstone_entry_header_class' ) ) { /** * Bstone entry header class * * @since 1.0.0 */ function bstone_entry_header_class() { $post_id = bstone_get_post_id(); $classes = array(); $title_markup = bstone_the_title( '', '', $post_id, false ); $thumb_markup = bstone_get_post_thumbnail( '', '', false ); $post_meta_markup = bstone_single_get_post_meta( '', '', false ); if ( empty( $title_markup ) && empty( $thumb_markup ) && ( is_page() || empty( $post_meta_markup ) ) ) { $classes[] = 'bst-header-without-markup'; } else { if ( empty( $title_markup ) ) { $classes[] = 'bst-no-title'; } if ( empty( $thumb_markup ) ) { $classes[] = 'bst-no-thumbnail'; } if ( is_page() || empty( $post_meta_markup ) ) { $classes[] = 'bst-no-meta'; } } $classes = array_unique( apply_filters( 'bstone_entry_header_class', $classes ) ); $classes = array_map( 'sanitize_html_class', $classes ); echo esc_attr( join( ' ', $classes ) ); } }// End if(). /** * Return schema markup * * @since 1.0.0 */ if ( ! function_exists( 'bstone_schema_markup' ) ) { function bstone_schema_markup( $location ) { // Return if disable if ( false == bstone_options( 'bstone-schema-markup' ) ) { return ''; } // 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( 'bstone_schema_markup', $schema ); } }// End if().