ID, 'blog_express_settings', true ); if ( isset( $post_options['post_layout'] ) && ! empty( $post_options['post_layout'] ) ) { $layout = esc_attr( $post_options['post_layout'] ); } } return $layout; } endif; add_filter( 'blog_express_filter_theme_global_layout', 'blog_express_customize_global_layout' ); if ( ! function_exists( 'blog_express_add_footer_widgets' ) ) : /** * Add footer widgets. * * @since 1.0.0 */ function blog_express_add_footer_widgets() { get_template_part( 'template-parts/footer-widgets' ); } endif; add_action( 'blog_express_action_footer', 'blog_express_add_footer_widgets', 15 ); if ( ! function_exists( 'blog_express_add_related_posts' ) ) : /** * Add related posts. * * @since 1.0.0 */ function blog_express_add_related_posts() { $related_posts_status = blog_express_get_option( 'related_posts_status' ); if ( true === $related_posts_status ) { get_template_part( 'template-parts/related-posts' ); } } endif; add_action( 'blog_express_action_related', 'blog_express_add_related_posts', 10 ); if ( ! function_exists( 'blog_express_add_footer_credits' ) ) : /** * Add footer credits. * * @since 1.0.0 */ function blog_express_add_footer_credits() { get_template_part( 'template-parts/footer-credits' ); } endif; add_action( 'blog_express_action_footer', 'blog_express_add_footer_credits', 20 ); if ( ! function_exists( 'blog_express_add_header_banner' ) ) : /** * Add header banner. * * @since 1.0.0 */ function blog_express_add_header_banner() { // Hide header banner in builder template. if ( is_page_template( 'templates/builder.php' ) ) { return; } // Hide header banner in elementor template. if ( is_page_template('elementor_header_footer') ) { return; } // Hide in front pages. if ( is_front_page() || is_home() ) { return; } get_template_part( 'template-parts/header-banner' ); } endif; add_action( 'blog_express_action_header', 'blog_express_add_header_banner', 15 ); if ( ! function_exists( 'blog_express_mobile_navigation' ) ) : /** * Mobile navigation. * * @since 1.0.0 */ function blog_express_mobile_navigation() { ?>
'blog-express-post-thumb aligncenter', ); the_post_thumbnail( 'large', $args ); } } endif; add_action( 'blog_express_single_image', 'blog_express_add_image_in_single_display' ); if ( ! function_exists( 'blog_express_add_image_in_archive_display' ) ) : /** * Add image in archive template. * * @since 1.0.0 */ function blog_express_add_image_in_archive_display() { $archive_layout = blog_express_get_option( 'archive_layout' ); $image_size = ( 'simple' === $archive_layout ) ? 'large' : 'blog-express-thumb'; ?> '; blog_express_breadcrumb(); echo ''; } } endif; add_action( 'blog_express_action_breadcrumb', 'blog_express_add_breadcrumb', 10 ); if ( ! function_exists( 'blog_express_add_featured_slider_front' ) ) : /** * Add featured slider. * * @since 1.0.0 */ function blog_express_add_featured_slider_front() { if ( ! is_front_page() ) { return; } $featured_slider_status = blog_express_get_option( 'featured_slider_status' ); if ( 'disabled' !== $featured_slider_status ) { get_template_part( 'template-parts/featured', 'slider' ); } } endif; add_action( 'blog_express_action_header', 'blog_express_add_featured_slider_front', 50 ); if ( ! function_exists( 'blog_express_get_slider_details' ) ) : /** * Slider details. * * @since 1.0.0 * * @param array $input Slider details. * @return array Updated details. */ function blog_express_get_slider_details( $input ) { $featured_slider_type = blog_express_get_option( 'featured_slider_type' ); $featured_slider_number = blog_express_get_option( 'featured_slider_number' ); switch ( $featured_slider_type ) { case 'featured-page': $ids = array(); for ( $i = 1; $i <= $featured_slider_number; $i++ ) { $id = blog_express_get_option( 'featured_slider_page_' . $i ); if ( ! empty( $id ) ) { $ids[] = absint( $id ); } } // Bail if no valid ids. if ( empty( $ids ) ) { return $input; } $qargs = array( 'posts_per_page' => absint( $featured_slider_number ), 'no_found_rows' => true, 'orderby' => 'post__in', 'post_type' => 'page', 'post__in' => $ids, 'suppress_filters' => false, 'meta_query' => array( array( 'key' => '_thumbnail_id' ), ), ); // Fetch posts. $all_posts = get_posts( $qargs ); $slides = array(); if ( ! empty( $all_posts ) ) { $cnt = 0; foreach ( $all_posts as $key => $post ) { if ( has_post_thumbnail( $post->ID ) ) { $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $slides[ $cnt ]['images']['full'] = $image_array; $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'blog-express-carousel' ); $slides[ $cnt ]['images']['medium'] = $image_array; $slides[ $cnt ]['title'] = get_the_title( $post->ID ); $slides[ $cnt ]['url'] = get_permalink( $post->ID ); $slides[ $cnt ]['date'] = ''; $slides[ $cnt ]['category'] = ''; $cnt++; } } } if ( ! empty( $slides ) ) { $input = $slides; } break; case 'featured-category': $featured_slider_category = blog_express_get_option( 'featured_slider_category' ); $qargs = array( 'posts_per_page' => absint( $featured_slider_number ), 'no_found_rows' => true, 'post_type' => 'post', 'suppress_filters' => false, 'meta_query' => array( array( 'key' => '_thumbnail_id' ), ), ); if ( absint( $featured_slider_category ) > 0 ) { $qargs['cat'] = absint( $featured_slider_category ); } // Fetch posts. $all_posts = get_posts( $qargs ); $slides = array(); if ( ! empty( $all_posts ) ) { $cnt = 0; foreach ( $all_posts as $key => $post ) { if ( has_post_thumbnail( $post->ID ) ) { $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $slides[ $cnt ]['images']['full'] = $image_array; $image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'blog-express-carousel' ); $slides[ $cnt ]['images']['medium'] = $image_array; $slides[ $cnt ]['title'] = get_the_title( $post->ID ); $slides[ $cnt ]['url'] = get_permalink( $post->ID ); $slides[ $cnt ]['date'] = get_the_time( get_option( 'date_format' ), $post->ID ); $slides[ $cnt ]['category'] = blog_express_get_post_category( $post->ID ); $cnt++; } } } if ( ! empty( $slides ) ) { $input = $slides; } break; default: break; } return $input; } endif; add_filter( 'blog_express_filter_slider_details', 'blog_express_get_slider_details' );