How To Display Random Posts Via AJAX In Your WordPress Site ?

Unlike to related blog posts you can also display a list pf randomly selected blog posts via AJAX at the end of all or a few selected blog posts. The plugin becomes more useful if when you write any article which is not related to your blog category and related posts plugin fails in displaying other related posts. In such case you can disable related posts on that article and add a shortcode to display randomly selected blog posts.

So first install and activate the plugin called AJAX Random Posts. After activation if you want to display random posts manually on selected articles then simply copy paste <!–ajaxrp–> at the end of your posts.

OR if you want to display random posts after each and every posts you have published then copy paste the following template in your theme’s single.php file: <?php if (function_exists(‘ajaxrp’)) ajaxrp(); ?>

Other than this the plugin provides you a few more options on Dashboard -> Settings -> AJAX Random Posts page:

  1. Number of posts in the list.
  2. Custom AJAX loading message
  3. Include sticky (featured) post in the list
  4. Automatically display the random posts in a single post page
  5. Custom HTML code before and after the list and custom post format

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.