Show post number in widget loop

It’s not clearly stated in your question, but I guess, you added exactly this code to the widget file: <?php echo $wp_query->current_post +1; ?> Am I right? If so, then it couldn’t work, because this code takes the counter from global $wp_query object, but… This widget doesn’t use global $wp_query and uses custom WP_Query instance. … Read more

Global $wpdb is not showing correct data with function call

With @Jacob Peattie suggestion, I have recoded it & it is working perfectly fine with functions. /* Recent updated post & pages */ if ( ! function_exists( ‘iq_recent_update’ ) ) : function iq_recent_update() { $orig_post = $post; global $post; $args=array( ‘posts_per_page’ => 3, ‘orderby’ => ‘modified’, ‘order’ => ‘DESC’, ‘post_type’ => array(‘post’, ‘page’), ‘post_status’ => … Read more