true ) ); foreach ( $vmagazine_categories as $vmagazine_category ) { $vmagazine_cat_array[$vmagazine_category->term_id] = $vmagazine_category->cat_name.' ('. $vmagazine_category->category_count.')'; } //categories in dropdown $vmagazine_cat_dropdown['0'] = esc_html__( '--Select Category--', 'vmagazine-lite' ); foreach ( $vmagazine_categories as $vmagazine_category ) { $vmagazine_cat_dropdown[$vmagazine_category->term_id] = $vmagazine_category->cat_name.' ('. $vmagazine_category->category_count.')'; } /** * radio option for types */ $vmagazine_posts_type = array( 'latest_posts' => esc_html__( 'From Latest Posts', 'vmagazine-lite' ), 'random_posts' => esc_html__( 'Random Posts', 'vmagazine-lite' ), 'category_posts' => esc_html__( 'From Selected Category', 'vmagazine-lite' ) ); /*--------------------------------------------------------------------------------------------------------*/ /** * Widget title function * * @param $widget_title string * @param $widget_title url * * @return

Widget title

or

widget title

( if widet url is not empty ) */ if( ! function_exists( 'vmagazine_lite_widget_title' ) ): function vmagazine_lite_widget_title( $widget_title, $vmagazine_cat_id ) { if( empty($widget_title) && empty( $vmagazine_cat_id ) ) { return; } ?>

'; $output .= $old_title; $output .= ''; return $output; }else{ return $old_title; } } add_filter( 'widget_title', 'vmagazine_lite_html_widget_title' ); /*===========================================================================================================*/ /** * Function about custom query arguments * * @param string $vmagazine_query_type (required options "latest_posts" or " ") * @param int $vmagazine_post_count * @param int $vmagazine_cat_id * @return array $vmagazine_args */ if( ! function_exists( 'vmagazine_lite_query_args' ) ) : function vmagazine_lite_query_args( $vmagazine_query_type, $vmagazine_post_count, $vmagazine_cat_id = null) { if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; } if( $vmagazine_query_type == 'category_posts' && !empty( $vmagazine_query_type ) ) { $vmagazine_args = array( 'post_type' => 'post', 'paged' => $paged, 'category__in' => $vmagazine_cat_id, 'posts_per_page' => $vmagazine_post_count, ); } elseif( $vmagazine_query_type == 'latest_posts' ) { $vmagazine_args = array( 'post_type' => 'post', 'paged' => $paged, 'posts_per_page' => $vmagazine_post_count, 'ignore_sticky_posts' => 1 ); }else{ $vmagazine_args = array( 'post_type' => 'post', 'orderby' => 'rand', 'paged' => $paged, 'posts_per_page' => $vmagazine_post_count, 'ignore_sticky_posts' => 1 ); } return $vmagazine_args; } endif; /*--------------------------------------------------------------------------------------------------------*/ /** * View all button in block section */ if( !function_exists( 'vmagazine_lite_block_view_all' ) ): function vmagazine_lite_block_view_all( $vmagazine_block_cat_id, $view_all_text ) { if( $vmagazine_block_cat_id != null ) { $vmagazine_block_cat_link = get_category_link( $vmagazine_block_cat_id ); ?>