' . "\n", get_bloginfo( 'pingback_url' ) ); } } /** * Schema for tag. */ if ( ! function_exists( 'ast_schema_body' ) ) : /** * Adds schema tags to the body classes. * * @since 1.0.0 */ function ast_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( 'astra_schema_body_itemtype', $itemtype ); // Return our HTML. echo apply_filters( 'astra_schema_body', "itemtype='http://schema.org/" . esc_html( $result ) . "' itemscope='itemscope'" ); } endif; /** * Adds custom classes to the array of body classes. */ if ( ! function_exists( 'ast_body_classes' ) ) { /** * Adds custom classes to the array of body classes. * * @since 1.0.0 * @param array $classes Classes for the body element. * @return array */ function ast_body_classes( $classes ) { if ( wp_is_mobile() ) { $classes[] = 'ast-header-break-point'; } // Apply header layout class to the body. $classes[] = 'header-main-layout-1'; // Apply separate container class to the body. $content_layout = ast_get_content_layout(); if ( 'content-boxed-container' == $content_layout ) { $classes[] = 'ast-separate-container'; } elseif ( 'boxed-container' == $content_layout ) { $classes[] = 'ast-separate-container ast-two-container'; } elseif ( 'page-builder' == $content_layout ) { $classes[] = 'ast-page-builder-template'; } elseif ( 'plain-container' == $content_layout ) { $classes[] = 'ast-plain-container'; } // Sidebar location. $page_layout = 'ast-' . ast_page_layout(); $classes[] = $page_layout; return $classes; } }// End if(). add_filter( 'body_class', 'ast_body_classes' ); /** * Astra Pagination */ if ( ! function_exists( 'ast_number_pagination' ) ) { /** * Astra Pagination * * @since 1.0.0 * @return void Generate & echo pagination markup. */ function ast_number_pagination() { echo "
"; the_posts_pagination( array( 'prev_text' => ast_default_strings( 'string-blog-navigation-previous', false ), 'next_text' => ast_default_strings( 'string-blog-navigation-next', false ), ) ); echo '
'; } }// End if(). add_action( 'ast_pagination', 'ast_number_pagination' ); /** * Return or echo site logo markup. */ if ( ! function_exists( 'ast_logo' ) ) { /** * Return or echo site logo markup. * * @since 1.0.0 * @param boolean $echo Echo markup. * @return mixed echo or return markup. */ function ast_logo( $echo = true ) { $site_tagline = ast_get_option( 'display-site-tagline' ); $display_site_tagline = ast_get_option( 'display-site-title' ); $logo = apply_filters( 'ast_logo_url', ast_get_option( 'site-logo' ) ); $html = ''; // Site logo. $html .= ''; $html .= get_custom_logo(); $html .= ''; // 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' ) . '

'; } /** * Echo or Return the Logo Markup */ if ( $echo ) { echo apply_filters( 'ast_logo', $html ); } else { return apply_filters( 'ast_logo', $html ); } } }// End if(). /** * Return the selected sections */ if ( ! function_exists( 'ast_get_dynamic_header_content' ) ) { /** * Return the selected sections * * @since 1.0.0 * @param string $option Custom content type. E.g. search, text-html etc. * @return array Array of Custom contents. */ function ast_get_dynamic_header_content( $option ) { $output = array(); $section = ast_get_option( $option ); switch ( $section ) { case 'search': $output[] = ast_get_search( $option ); break; case 'text-html': $output[] = ast_get_custom_html( $option . '-html' ); break; } return $output; } } /** * Adding Wrapper for Search Form. */ if ( ! function_exists( 'ast_get_search' ) ) { /** * Adding Wrapper for Search Form. * * @since 1.0.0 * @param string $option Search Option name. * @return mixed Search HTML structure created. */ function ast_get_search( $option = '' ) { $search_html = '
'; return apply_filters( 'ast_get_search', $search_html, $option ); } } /** * Get custom HTML added by user. */ if ( ! function_exists( 'ast_get_custom_html' ) ) { /** * Get custom HTML added by user. * * @since 1.0.0 * @param string $option_name Option name. * @return String TEXT/HTML added by user in options panel. */ function ast_get_custom_html( $option_name = '' ) { $custom_html = ''; $custom_html_content = ast_get_option( $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', 'astra' ) . ''; } return $custom_html; } } /** * Astra Theme Nav Menu */ if ( ! function_exists( 'ast_nav_menu' ) ) { /** * Helper function for wp_nav_menu() checks if menu is set, if not set returns with message for capable users to set the menu. * * @since 1.0.0 * @param array $menu It will be either 'Menu location' (string) or Argument array of 'Menu'. * @param array $fallback_menu Fallback menu if menu location is not set. * @param boolean $echo Echo menu markup. * @return mixed Echo or Return Markup for menu or message to set the menu. */ function ast_nav_menu( $menu = array(), $fallback_menu = array(), $echo = true ) { /** * Get menu / fallback menu markup */ if ( has_nav_menu( $menu['theme_location'] ) ) { // Initially set echo to false and get nav markup. $menu['echo'] = false; $nav = wp_nav_menu( $menu ); /** * Has fallback menu support? */ } elseif ( false == $fallback_menu ) { /* translators: 1: nav manu location 2: menu location name */ $nav = printf( __( 'Assign a menu to location %2$s ', 'astra' ), admin_url( 'nav-menus.php?action=locations' ), strtoupper( $menu['theme_location'] ) ); /** * Set fallback menu support. */ } else { // Initially set echo to false and get nav markup. $fallback_menu['echo'] = false; $nav = wp_page_menu( $fallback_menu ); } /** * Echo / return markup */ if ( $echo ) { echo $nav; } else { return $nav; } } }// End if(). /** * Function to get Small Left/Right Footer */ if ( ! function_exists( 'ast_get_small_footer' ) ) { /** * Function to get Small Left/Right Footer * * @since 1.0.0 * @param string $section Sections of Small Footer. * @return mixed Markup of sections. */ function ast_get_small_footer( $section = '' ) { $small_footer_type = ast_get_option( $section ); $output = null; switch ( $small_footer_type ) { case 'menu': $output = ast_get_small_footer_menu(); break; case 'custom': $output = ast_get_option( $section . '-credit' ); $output = str_replace( '[current_year]', date( 'Y' ), $output ); $output = str_replace( '[site_title]', '' . get_option( 'blogname' ) . '', $output ); $theme_author = apply_filters( 'ast_theme_author', array( 'theme_name' => __( 'Astra', 'astra' ), 'theme_author_url' => 'https://www.brainstormforce.com/', ) ); $output = str_replace( '[theme_author]', '' . $theme_author['theme_name'] . '', $output ); break; } return $output; } }// End if(). /** * Function to get Footer Menu */ if ( ! function_exists( 'ast_get_small_footer_menu' ) ) { /** * Function to get Footer Menu * * @since 1.0.0 * @return html */ function ast_get_small_footer_menu() { ob_start(); ?> * * @since 1.0.0 */ function ast_header_markup() { ?>
'primary', 'menu_id' => 'primary-menu', 'menu_class' => 'main-header-menu ast-flex ast-justify-content-flex-end' . $submenu_class, 'container_class' => 'main-navigation', 'echo' => false, 'container' => 'div', 'walker' => new Ast_Nav_Menu_Walker(), ); // Fallback Menu if primary menu not set. $fallback_menu_args = array( 'menu_class' => 'main-navigation', 'menu_id' => 'primary-menu', 'container' => 'div', 'before' => '', 'echo' => false, 'walker' => new Ast_Walker_Page(), // Below option is NOT a nav page menu option. // Just used to apply filter to add custom menu items though filter. 'theme_location' => 'primary', ); ?>
* * @since 1.0.0 */ function ast_footer_markup() { ?> .main-header-bar-wrap { content: ""; } @media all and ( min-width: px ) { .main-header-bar-wrap { content: ""; } } @media ( min-width: 920px ) { .single .site-content > .ast-container { max-width : px; } }

' . '

'; $fields['email'] = '

' . '

'; $fields['url'] = '

'; return $fields; } } add_filter( 'comment_form_default_fields', 'ast_comment_form_default_fields_markup' ); /** * Function to filter comment form arguments */ if ( ! function_exists( 'ast_comment_form_default_markup' ) ) { /** * Function filter comment form arguments * * @since 1.0.0 * @param array $args Comment form arguments. * @return array */ function ast_comment_form_default_markup( $args ) { $args['id_form'] = 'ast-commentform'; $args['title_reply'] = ast_default_strings( 'string-comment-title-reply', false ); $args['cancel_reply_link'] = ast_default_strings( 'string-comment-cancel-reply-link', false ); $args['label_submit'] = ast_default_strings( 'string-comment-label-submit', false ); $args['comment_field'] = '
'; return $args; } } add_filter( 'comment_form_defaults', 'ast_comment_form_default_markup' ); /** * Function to filter comment form arguments */ if ( ! function_exists( 'ast_404_page_layout' ) ) { /** * Function filter comment form arguments * * @since 1.0.0 * @param array $layout Comment form arguments. * @return array */ function ast_404_page_layout( $layout ) { if ( is_404() ) { $layout = 'no-sidebar'; } return $layout; } } add_filter( 'ast_page_layout', 'ast_404_page_layout', 10, 1 ); /** * Return current content layout */ if ( ! function_exists( 'ast_get_content_layout' ) ) { /** * Return current content layout * * @since 1.0.0 * @return boolean content layout. */ function ast_get_content_layout() { $value = false; if ( is_singular() ) { // If post meta value is empty, // Then get the POST_TYPE content layout. $content_layout = ast_get_option_meta( 'site-content-layout', '', '', true ); if ( empty( $content_layout ) ) { $content_layout = ast_get_option( 'single-' . get_post_type() . '-content-layout', '', '' ); if ( 'default' == $content_layout || empty( $content_layout ) ) { // Get the GLOBAL content layout value. // NOTE: Here not used `true` in the below function call. $content_layout = ast_get_option( 'site-content-layout', '', 'full-width' ); } } } else { $content_layout = ast_get_option( 'archive-' . get_post_type() . '-content-layout', '', '' ); if ( is_search() ) { $content_layout = ast_get_option( 'archive-post-content-layout', '', '' ); } if ( 'default' == $content_layout || empty( $content_layout ) ) { // Get the GLOBAL content layout value. // NOTE: Here not used `true` in the below function call. $content_layout = ast_get_option( 'site-content-layout', '', 'full-width' ); } } return apply_filters( 'ast_get_content_layout', $content_layout ); } }// End if(). add_filter( 'ast_the_title_enabled', 'page_builder_disable_title', 12 ); /** * Disbale title for Page Builder template */ if ( ! function_exists( 'page_builder_disable_title' ) ) { /** * Disbale title for Page Builder template * * @since 1.0.0 * @param boolean $default Title enabled or not. * @return boolean Title enable or disable. */ function page_builder_disable_title( $default ) { $content_layout = ast_get_content_layout(); if ( 'page-builder' == $content_layout ) { $default = false; } return $default; } } /** * Display Blog Post Excerpt */ if ( ! function_exists( 'ast_the_excerpt' ) ) { /** * Display Blog Post Excerpt * * @since 1.0.0 */ function ast_the_excerpt() { $excerpt_type = ast_get_option( 'blog-post-content' ); if ( 'full-content' == $excerpt_type ) { the_content(); } else { the_excerpt(); } } }