Hello friends, welcome to my another blog post how to show recent posts using SQL Query WordPress. If you want to create your own widget to show recent posts from your own style or if you do not use WordPress query post then you have the option to fetch your post from your database table and display them. Today I will show you how to do that.

This function is useful when you need to display content, excerpt, custom fields, or anything related to the post beyond it’s link and title. Copy ans paste the below code in your theme functions.php page.



Now you can paste below code in the sidebar or wherever you like the recent posts to list

By default it show 10 posts with excerpt but you can change it by passing parameters into the function like this It will show 5 posts excluding excerpts.

Thank you for your time. Now you know how to show recent posts using SQL Query WordPress.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Show Recent Posts using SQL Query WordPress