term_id; $news_vibrant_title_cat_link = get_theme_mod( 'news_vibrant_widget_cat_link_option', true ); $news_vibrant_title_cat_color = get_theme_mod( 'news_vibrant_widget_cat_color_option', true ); if ( true == $news_vibrant_title_cat_color ) { $title_class = 'nv-title nv-cat-'. $news_vibrant_block_cat_id; } else { $title_class = 'nv-title'; } if ( !empty( $news_vibrant_block_cat_id ) && true == $news_vibrant_title_cat_link ) { $news_vibrant_blcok_cat_link = get_category_link( $news_vibrant_block_cat_id ); echo '

'. esc_html( $news_vibrant_block_title ) .'

'; } else { echo '

'. esc_html( $news_vibrant_block_title ) .'

'; } } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_block_default_layout_section' ) ) : /** * Block Default Layout * * @since 1.0.0 */ function news_vibrant_block_default_layout_section( $cat_slug ) { if ( empty( $cat_slug ) ) { return; } $news_vibrant_post_count = apply_filters( 'news_vibrant_block_default_posts_count', 6 ); $block_args = array( 'category_name' => esc_attr( $cat_slug ), 'posts_per_page' => absint( $news_vibrant_post_count ), ); $block_query = new WP_Query( $block_args ); $total_posts_count = $block_query->post_count; if ( $block_query->have_posts() ) { $post_count = 1; while( $block_query->have_posts() ) { $block_query->the_post(); if ( $post_count == 1 ) { echo '
'; $title_size = 'large-size'; } elseif ( $post_count == 2 ) { echo '
'; $title_size = 'small-size'; } else { $title_size = 'small-size'; } ?>

'; } elseif ( $post_count == $total_posts_count ) { echo '
'; } $post_count++; } } wp_reset_postdata(); } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_block_second_layout_section' ) ) : /** * Block Second Layout * * @since 1.0.0 */ function news_vibrant_block_second_layout_section( $cat_slug ) { if ( empty( $cat_slug ) ) { return; } $news_vibrant_post_count = apply_filters( 'news_vibrant_block_second_layout_posts_count', 6 ); $block_args = array( 'category_name' => esc_attr( $cat_slug ), 'posts_per_page' => absint( $news_vibrant_post_count ), ); $block_query = new WP_Query( $block_args ); $total_posts_count = $block_query->post_count; if ( $block_query->have_posts() ) { $post_count = 1; while( $block_query->have_posts() ) { $block_query->the_post(); if ( $post_count == 1 ) { echo '
'; } elseif ( $post_count == 3 ) { echo '
'; } if ( $post_count <= 2 ) { $title_size = 'large-size'; } else { $title_size = 'small-size'; } ?>

'; } elseif ( $post_count == $total_posts_count ) { echo '
'; } $post_count++; } } wp_reset_postdata(); } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_block_box_layout_section' ) ) : /** * Block Box Layout * * @since 1.0.0 */ function news_vibrant_block_box_layout_section( $cat_slug ) { if ( empty( $cat_slug ) ) { return; } $news_vibrant_post_count = apply_filters( 'news_vibrant_block_box_posts_count', 4 ); $block_args = array( 'category_name' => esc_attr( $cat_slug ), 'posts_per_page' => absint( $news_vibrant_post_count ), ); $block_query = new WP_Query( $block_args ); $total_posts_count = $block_query->post_count; if ( $block_query->have_posts() ) { $post_count = 1; while( $block_query->have_posts() ) { $block_query->the_post(); if ( $post_count == 1 ) { echo '
'; $title_size = 'large-size'; } elseif ( $post_count == 2 ) { echo '
'; $title_size = 'small-size'; } else { $title_size = 'small-size'; } ?>

'; } elseif ( $post_count == $total_posts_count ) { echo '
'; } $post_count++; } } wp_reset_postdata(); } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_block_alternate_grid_section' ) ) : /** * Block alternate grid * * @since 1.0.0 */ function news_vibrant_block_alternate_grid_section( $cat_slug ) { if ( empty( $cat_slug ) ) { return; } $news_vibrant_post_count = apply_filters( 'news_vibrant_block_alternate_grid_posts_count', 3 ); $block_args = array( 'category_name' => esc_attr( $cat_slug ), 'posts_per_page' => absint( $news_vibrant_post_count ), ); $block_query = new WP_Query( $block_args ); $total_posts_count = $block_query->post_count; if ( $block_query->have_posts() ) { while( $block_query->have_posts() ) { $block_query->the_post(); ?>

have_posts() ) { echo '
    '; while( $news_vibrant_block_query->have_posts() ) { $news_vibrant_block_query->the_post(); ?>
  • '; } wp_reset_postdata(); } endif;