How To Display Last Recent Updates List WordPress Beginners Tricks

Please log in or register to like posts.
News

To display wordpress recent upadates, in this article will help you to display your last posts in recent updates on your wordpress site. beginners needs to know about best wordpress practice to make their blog own stylish. some of new wordpress developer and designers don’t know how to start wordpress and how to make functions. if you are a new developer in wordpress, you need to know needed some wordpress tricks to increase you idea about wordpress development. below i was linked some useful wordpress tricks article, you can read more for getting ideas and code functions for wordpress development. So, guys, now we are going to make recent updates in our wordpress theme index.php file.

 

Recent Updates

In the wordpress code will help you to display wordpress recent post updates function, you can call last list of posts to your theme file where you want to show it up.  at first go to your wordpress theme folder and find where the functions.php file, or navigate from WP admin panel – Appearance>Editor>functions.php then copy past the below code after <?php tag.

function wpb_lastupdated_posts() { 

// Query Arguments
$lastupdated_args = array(
'orderby' => 'modified',
'ignore_sticky_posts' => '1'
);

//Loop to display 5 recently updated posts
$lastupdated_loop = new WP_Query( $lastupdated_args );
$counter = 1;
$string .= '<ul>';
while( $lastupdated_loop->have_posts() && $counter < 5 ) : $lastupdated_loop->the_post();
$string .= '<li><a href="' . get_permalink( $lastupdated_loop->post->ID ) . '"> ' .get_the_title( $lastupdated_loop->post->ID ) . '</a> ( '. get_the_modified_date() .') </li>';
$counter++;
endwhile; 
$string .= '</ul>';
return $string;
wp_reset_postdata(); 
} 

//add a shortcode
add_shortcode('lastupdated-posts', 'wpb_lastupdated_posts');

remember, the above function only output 5 updates, to change or increase limit of showing wordpress recent updates simply edit the function < 5 replace the number if you want 10.

now copy and past the below code to index.php file or anywhere to showing the recent updates from your wordpress last updates.

<?php 
if (function_exists(wpb_lastupdated_posts)) : 
wpb_lastupdated_posts();
endif;
?>

Now Refresh your website to see effects. Hope the wordpress tricks will help you a lot. if you face any kind of problems, just drop your comments.

 

WordPress Tricks

10+ Most Wanted WP  Tips, Tricks, and Hacks – HowTrick
How to Fix WP 404 Post Returning Error Issue
How to fix Establish Database Connection in WP
What is Internal server error and how to fix – WP
How To Display Random Posts in WP – Coding
How to Change the WP Login Logo – Custom Logo
WordPress Theme Development « WP Codex
8 Extremely Useful WP Functions For Developers

Wanted WordPress Tips Tricks and Hacks – WordPress Beginner Tutorial

Nobody liked ?

2 comments on “How To Display Last Recent Updates List WordPress Beginners Tricks

  1. Keep up the amazing quality writing, it is rare to see a nice blogs like this one these days. I am going to follow you on Reddit. Your blogs are a shock. There are certainly a lot of stuff to take into consideration. I feel like people should send you cash for this great content.

Leave a Reply

Your email address will not be published. Required fields are marked *