wordpress get random posts from category

In wordpress widget or on homepage, In wordpress get random posts from category. Here in wordpress tutorial we have given some nice tricks and tips for wordpress developers. There are many ways to achieve this. I can recommend to use Page Builder Plugin and use smart posts widget plugin.

wordpress get random posts from category

Above plugin will not add any database table to your wordpress website. We prefer to use the above plugin. Using smart posts widget plugin, you can show random post with simple setting or configuration.

Still you want to show random post by using code than use following code.


$smart_posts = new WP_Query($query_params);

while ( $smart_posts->have_posts() )
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<?php the_post_thumbnail(); ?>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</a>
<?php the_excerpt(); ?> 




Features of Plugin which shows every types of posts.

Smart Posts Widget

wordpress get random posts from category

wordpress get random posts from category


Smart Posts Widget – is designed to show your posts as you want without any programming knowledge. display all type of post types from a certain post type or post category or post tags.

There are many options for user to filter or order posts. You can able to select many options to choose your posts.

Smart Posts Widgets developed to provide very easy to user for displaying all types of posts within your widget areas.

widget is compatible with Page Builder. You can create beautiful page layouts and show posts as per your choice.

Add a Comment

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