implode( '&family=', $font_families ), 'display' => 'swap', ), 'https://fonts.googleapis.com/css2' ); return esc_url_raw($fonts_url); } } /* |-------------------------------------------------------------------------- | Header builder structure |-------------------------------------------------------------------------- | */ if ( ! function_exists( 'bizness_header_builder' ) ) { /** * Function to return header builder elements * * @return void */ function bizness_header_builder() { $header_elements = ['top','main','bottom']; if ( !empty( $header_elements ) && in_array( 'top', $header_elements, true ) ) { $top_left_col_elements = get_theme_mod( 'header_top_left_elements'); $top_center_col_elements = get_theme_mod( 'header_top_center_elements'); $top_right_col_elements = get_theme_mod( 'header_top_right_elements'); $top_header_class = ['site-header-row']; // If any left and right column is active if ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id')) === FALSE ) ) { $top_header_class[] = ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id')) === FALSE ) && ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id')) === FALSE ) ) ? 'has-sides-column' : 'has-side-column'; } else { $top_header_class[] = 'no-sides-column'; } // If center column is active if ( ( ! empty( $top_center_col_elements ) && array_search('none', array_column($top_center_col_elements, 'element_id')) === FALSE ) ) { $top_header_class[] = ( empty( $top_left_col_elements ) && empty( $top_right_col_elements ) ) ? 'has-only-center-column has-center-column' : 'has-center-column'; } else { $top_header_class[] = 'no-center-column'; } if ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $top_center_col_elements ) && array_search('none', array_column($top_center_col_elements, 'element_id')) === FALSE ) || ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id')) === FALSE ) ) { ?> 'identity' ] ] ); $main_center_col_elements = get_theme_mod( 'header_main_center_elements' ); $main_right_col_elements = get_theme_mod( 'header_main_right_elements', [ [ 'element_id' => 'menu_1' ] ] ); $main_header_class = ['site-header-row']; // If any left and right column is active if ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id')) === FALSE ) ) { $main_header_class[] = ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id')) === FALSE ) && ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id')) === FALSE ) ) ? 'has-sides-column' : 'has-side-column'; } else { $main_header_class[] = 'no-sides-column'; } // If center column is active if ( ( ! empty( $main_center_col_elements ) && array_search('none', array_column($main_center_col_elements, 'element_id')) === FALSE ) ) { $main_header_class[] = ( empty( $main_left_col_elements ) && empty( $main_right_col_elements ) ) ? 'has-only-center-column has-center-column' : 'has-center-column'; } else { $main_header_class[] = 'no-center-column'; } if ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $main_center_col_elements ) && array_search('none', array_column($main_center_col_elements, 'element_id')) === FALSE ) || ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id')) === FALSE ) ) { ?> $single_element ) { if ( array_search('none', array_column($header_column_elements, 'element_id')) === FALSE ) { $id = $single_element['element_id']; if ( file_exists( trailingslashit( get_template_directory() ) . 'template-parts/header/' . $id . '.php' ) ) { get_template_part( 'template-parts/header/' . $id ); } else { echo esc_html__( 'Create New File ', 'bizness' ) . 'template-parts/header/' . $id . '.php'; } } } } /* |-------------------------------------------------------------------------- | Footer builder structure |-------------------------------------------------------------------------- | */ if ( ! function_exists( 'bizness_footer_builder' ) ) { /** * Function to return footer builder elements * * @return void */ function bizness_footer_builder() { $footer_elements = ['top','main','bottom']; // Top Section if ( !empty( $footer_elements ) && in_array( 'top', $footer_elements, true ) ) { $top_left_col_elements = get_theme_mod( 'footer_top_left_elements'); $top_center_col_elements = get_theme_mod( 'footer_top_center_elements'); $top_right_col_elements = get_theme_mod( 'footer_top_right_elements'); $top_footer_class = ['row site-footer-row']; $top_col_class = ['site-footer-section']; $top_col_class[] = ( ( ! empty( $top_center_col_elements ) && array_search('none', array_column($top_center_col_elements, 'element_id') ) === FALSE ) && ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id') ) === FALSE ) || ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id') ) === FALSE ) ) ) ? 'col-12 col-md-4' : ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id') ) === FALSE ) && ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id') ) === FALSE ) ? 'col-12 col-md-6' : 'col-12' ); $top_col_class[] = 'd-flex align-items-center'; // If any left and right column is active if ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id') ) === FALSE ) && ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id') ) === FALSE ) ) { $top_footer_class[] = 'has-sides-column'; } else { $top_footer_class[] = 'no-sides-column'; } // If center column is active if ( ! empty( $top_center_col_elements ) && array_search('none', array_column($top_center_col_elements, 'element_id') ) === FALSE ) { $top_footer_class[] = ( empty( $top_left_col_elements ) && empty( $top_right_col_elements ) ) ? 'has-only-center-column has-center-column' : 'has-center-column'; } else { $top_footer_class[] = 'no-center-column'; } if ( ( ! empty( $top_left_col_elements ) && array_search('none', array_column($top_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $top_center_col_elements ) && array_search('none', array_column($top_center_col_elements, 'element_id')) === FALSE ) || ( ! empty( $top_right_col_elements ) && array_search('none', array_column($top_right_col_elements, 'element_id')) === FALSE ) ) { ?> 'copyright' ] ] ); $main_center_col_elements = get_theme_mod( 'footer_main_center_elements'); $main_right_col_elements = get_theme_mod( 'footer_main_right_elements'); $main_footer_class = ['row site-footer-row']; $main_col_class = ['site-footer-section']; $main_col_class[] = ( ( ! empty( $main_center_col_elements ) && array_search('none', array_column($main_center_col_elements, 'element_id') ) === FALSE ) && ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id') ) === FALSE ) || ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id') ) === FALSE ) ) ) ? 'col-12 col-md-4' : ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id') ) === FALSE ) && ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id') ) === FALSE ) ? 'col-12 col-md-6' : 'col-12' ); $main_col_class[] = 'd-flex align-items-center'; // If any left and right column is active if ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id') ) === FALSE ) && ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id') ) === FALSE ) ) { $main_footer_class[] = 'has-sides-column'; } else { $main_footer_class[] = 'no-sides-column'; } // If center column is active if ( ! empty( $main_center_col_elements ) && array_search('none', array_column($main_center_col_elements, 'element_id') ) === FALSE ) { $main_footer_class[] = ( empty( $main_left_col_elements ) && empty( $main_right_col_elements ) ) ? 'has-only-center-column has-center-column' : 'has-center-column'; } else { $main_footer_class[] = 'no-center-column'; } if ( ( ! empty( $main_left_col_elements ) && array_search('none', array_column($main_left_col_elements, 'element_id')) === FALSE ) || ( ! empty( $main_center_col_elements ) && array_search('none', array_column($main_center_col_elements, 'element_id')) === FALSE ) || ( ! empty( $main_right_col_elements ) && array_search('none', array_column($main_right_col_elements, 'element_id')) === FALSE ) ) { ?> $single_element ) { if ( array_search('none', array_column($footer_column_elements, 'element_id')) === FALSE ) { $id = $single_element['element_id']; if ( file_exists( trailingslashit( get_template_directory() ) . 'template-parts/footer/' . $id . '.php' ) ) { get_template_part( 'template-parts/footer/' . $id ); } else { echo esc_html__( 'Create New File ', 'bizness' ) . 'template-parts/footer/' . $id . '.php'; } } } } /* |-------------------------------------------------------------------------- | Social Network Options |-------------------------------------------------------------------------- | | Returns an array social network. */ if ( ! function_exists('bizness_social_network_list') ) { function bizness_social_network_list() { /** * Filters social network list * */ return apply_filters( 'bizness_social_network_list', array( 'fa-facebook' => esc_html__( 'Facebook', 'bizness' ), 'fa-twitter' => esc_html__( 'Twitter', 'bizness' ), 'fa-instagram' => esc_html__( 'Instagram', 'bizness' ), 'fa-linkedin' => esc_html__( 'Linkedin', 'bizness' ), 'fa-youtube' => esc_html__( 'Youtube', 'bizness' ), 'fa-vimeo' => esc_html__( 'Vimeo', 'bizness' ) ) ); } } /* |-------------------------------------------------------------------------- | Image Placeholder |-------------------------------------------------------------------------- | | Output image placeholder */ if ( ! function_exists( 'bizness_image_placeholder' ) ) { /** * Output image place holder for given size * * @param string $image_size - Image size. */ function bizness_image_placeholder( $image_size ) { echo bizness_get_image_placeholder( $image_size ); } } if ( ! function_exists( 'bizness_get_image_placeholder' ) ) { /** * Returns image place holder for given size * * @param string $image_size - Image size. * * @return string - Image HTML */ function bizness_get_image_placeholder( $image_size ) { if ( empty( $image_size ) ) { return ''; } // Get custom placeholder image if configured. $placeholder_custom_image_url = get_theme_mod( 'image_placeholder_image', '' ); if ( ! empty( $placeholder_custom_image_url ) ) { $placeholder_custom_image_id = bizness_get_attachment_id_from_url( $placeholder_custom_image_url ); if ( ! empty( $placeholder_custom_image_id ) ) { return wp_get_attachment_image( $placeholder_custom_image_id, $image_size, false, '' ); } // Otherwise get default placeholder } else { return sprintf( '%s', the_title_attribute( 'echo=0' ) ); } return ''; } } /* |-------------------------------------------------------------------------- | Sidebar Layout |-------------------------------------------------------------------------- | | Return sidebar layout */ if ( ! function_exists( 'bizness_get_sidebar_layout' ) ) { /** * Return sidebar layout value * * @param null $sidebar * @return string */ function bizness_get_sidebar_layout($sidebar = 'none') { global $post; if ($post) { // Check meta first to override and return (prevents filters from overriding meta) $sidebar = get_post_meta( $post->ID, 'bizness_sidebar_layout', true ); if ( $sidebar && $sidebar != 'default' ) { return $sidebar; } if ( is_single() ) { $sidebar = get_theme_mod( 'post_sidebar_layout', 'right' ); } elseif ( is_page() ) { $sidebar = get_theme_mod( 'page_sidebar_layout', 'right' ); } else { $sidebar = get_theme_mod( 'blog_sidebar_layout', 'right' ); } } return $sidebar; } } /* |-------------------------------------------------------------------------- | Site Main Primary Classes |-------------------------------------------------------------------------- | */ if ( ! function_exists( 'bizness_primary_class' ) ) { /** * Displays the class names for the primary element. * * @param string|string[] $class Space-separated string or array of class names to add to the class list. */ function bizness_primary_class($class = '') { echo 'class="' . esc_attr( implode( ' ', bizness_get_primary_class( $class ) ) ) . '"'; } } if ( ! function_exists( 'bizness_get_primary_class' ) ) { /** * Retrieves an array of the class names for the primary element. * * * @global WP_Query $wp_query WordPress Query object. * * @param string|string[] $class Space-separated string or array of class names to add to the class list. * @return string[] Array of class names. */ function bizness_get_primary_class( $class = '' ) { $classes = array('site-main'); $classes[] = bizness_get_sidebar_layout() === 'none' ? 'col-12' : 'col-lg-8'; if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } $classes = array_map( 'esc_attr', $classes ); /** * Filters the list of CSS primary class. * * @param string[] $classes An array of primary class names. * @param string[] $class An array of additional class names added to the primary. */ $classes = apply_filters( 'bizness_primary_class', $classes, $class ); return array_unique( $classes ); } } /* |-------------------------------------------------------------------------- | Display and retrive columns data values. |-------------------------------------------------------------------------- | */ if ( ! function_exists( 'bizness_columns_data' ) ) { /** * Output columns data attributes * * @param null $col_per_row * @return void */ function bizness_columns_data($col_per_row = null) { echo bizness_get_columns_data($col_per_row); } } if ( ! function_exists( 'bizness_get_columns_data' ) ) { /** * Return columns data attributes values * * @param null $col_per_row * @return string */ function bizness_get_columns_data( $col_per_row = null ) { if ( $col_per_row == 1 ) { return ' data-columns="'.esc_attr($col_per_row).'"'; } elseif ( $col_per_row == 2 ) { return ' data-columns=1 data-columns-md="'.esc_attr($col_per_row).'"'; } else { return ' data-columns=1 data-columns-md=2 data-columns-lg="'.esc_attr($col_per_row).'"'; } } } /* |-------------------------------------------------------------------------- | Display posts read more button. |-------------------------------------------------------------------------- | */ if ( ! function_exists( 'bizness_read_more' ) ) { /** * Post Read More * * @return void */ function bizness_read_more() { $read_more_type = get_theme_mod('blog_post_read_more_btn_type','link'); ob_start(); ?>
', '' ); } elseif ( is_404() ) { echo '<' . esc_attr($html_tag) . ' class="page-title">' . esc_html__( '404 Page','bizness' ) . ''; } elseif ( is_single() ) { the_title( '<' . esc_attr($html_tag) . ' class="page-title">', '' ); } elseif ( is_home() && ! is_front_page() ) { echo '<' . esc_attr($html_tag) . ' class="page-title">' . esc_html__( 'Blog','bizness' ) . ''; } elseif( is_search() ) { echo '<' . esc_attr($html_tag) . ' class="page-title">' . get_search_query() . ''; } elseif ( is_archive() ) { the_archive_title( '<' . esc_attr($html_tag) . ' class="page-title">', '' ); } } } /* |-------------------------------------------------------------------------- | Page Description |-------------------------------------------------------------------------- | | Display the page description based on page load */ if ( ! function_exists( 'bizness_page_description' ) ) { /** * Page description * * @return void */ function bizness_page_description() { echo '
'; if ( is_singular() ){ the_excerpt(); } elseif (is_404()) { $description = esc_html__( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'bizness' ); echo wpautop( wp_kses_post( $description )); } else { the_archive_description(); } echo '
'; } } /* |-------------------------------------------------------------------------- | Trail Breadcrumb |-------------------------------------------------------------------------- */ if ( ! function_exists( 'bizness_trail_breadcrumb' ) ) { /** * Display trail breadcrumb * * @return void */ function bizness_trail_breadcrumb() { $defaults = array( 'show_browse' => false, 'echo' => true, 'labels' => array( 'home' => esc_html__( 'Home', 'bizness' ), ), ); $args = apply_filters( 'breadcrumb_trail_args', $defaults ); $breadcrumb = apply_filters( 'breadcrumb_trail_object', null, $args ); if ( ! is_object( $breadcrumb ) ) $breadcrumb = new Bizness_Breadcrumb_Trail( $args ); return $breadcrumb->trail(); } } /* |-------------------------------------------------------------------------- | Page Site Class |-------------------------------------------------------------------------- */ if ( ! function_exists( 'bizness_site_class' ) ) { /** * Add the classes into page site * * @param string|array $class One or more classes to add to the class list. * @return void */ function bizness_site_class() { $classes = ['site']; if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } $classes = array_map( 'sanitize_html_class', $classes ); /** * Filter site class names */ $classes = apply_filters( 'bizness_site_class', $classes, $class ); $classes = array_unique( $classes ); echo 'class="' . esc_attr( join( ' ', $classes ) ) . '"'; // WPCS: XSS ok. } } /* |-------------------------------------------------------------------------- | Get Author ID |-------------------------------------------------------------------------- */ if ( ! function_exists( 'bizness_get_author_id' ) ) { function bizness_get_author_id() { $author_id = get_queried_object_id(); if (is_singular()) { $author_id = get_the_author_meta('ID'); } if (! $author_id) { $author = get_user_by('slug', get_query_var('author_name')); $author_id = $author->ID; } return $author_id; } } /* |-------------------------------------------------------------------------- | Author Box |-------------------------------------------------------------------------- */ if ( ! function_exists( 'bizness_author_box' ) ) { /** * Author Box Detail * * @return void */ function bizness_author_box() { // Only display for standard posts if ( 'post' != get_post_type() ) { return; } // Get author data $author = get_the_author(); $author_description = get_the_author_meta( 'description' ); $author_url = esc_url( get_author_posts_url( bizness_get_author_id() ) ); $author_avatar = get_avatar( bizness_get_author_id(), apply_filters( 'bizness_avatar_size', 150 ) ); $author_website = get_the_author_meta( 'url' ); $posts_count = count_user_posts(bizness_get_author_id()); $section_heading = get_theme_mod('single_post_author_box_section_heading',''); $content_elements = get_theme_mod('single_post_author_box_elements',[ 'name', 'website', 'bio-info', 'articles' ]); ?>

$element ) { echo '
'; // Is Author Name if ( $element === 'name' ) { ?>
' . esc_html__( 'Total Articles:', 'bizness' ) . ' %2$s
', esc_url( $author_url ), absint($posts_count) ); } echo '
'; } ?>
ID, [ 'fields' => 'ids' ] ); if ( ! empty( $cats ) ) { $args['posts_per_page'] = absint($posts_limit); $args['post__not_in'] = [$current_post->ID]; $args['category__in'] = $cats; $args['no_found_rows'] = true; $args['ignore_sticky_posts'] = true; } $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : // Columns per row $col_per_row = []; $col_per_row[] = get_theme_mod('single_related_post_sm_col_per_row','col-12'); $col_per_row[] = get_theme_mod('single_related_post_md_col_per_row','col-md-6'); $col_per_row[] = get_theme_mod('single_related_post_col_per_row','col-lg-6'); $section_heading = get_theme_mod('single_related_post_heading',esc_html__( 'Related Posts', 'bizness' )); $content_elements= get_theme_mod('single_related_post_elements_structure',[ 'post-image', 'post-title', 'post-excerpt' ]); ?>