Choose posts for the home/blog page of a WordPress site

Usually on the blog page, which is often the home page, of a WordPress site you see the ten latest blog posts. You can change the number in the settings (Dashboard -> Settings -> Reading or …/wp-admin/options-reading.php ), but cannot select which posts show up. The simplest and best solution I found for choosing posts for the home page is the NS Featured Posts plugin. Here is the plugin’s page on the developer’s, Nilambar Sharma’s site.

It is simple to use, but does require touching the code and for advanced features it doesn’t hurt if you understand PHP. But the basic use takes just 4 steps:

  1. Example of code for using NS Featured Posts WordPress pluginInstall and activate the plugin
  2. Enable it for posts and/or pages at
    Dashboard -> Settings -> NS Featured Posts or
    /wp-admin/options-general.php?page=ns-featured-posts
  3. Select a few posts to on the “view all posts” page of the admin dsahboard
  4. Change the query in template of the home page (or the one you want to display the featured posts) to
    $query = new WP_Query( array( ‘meta_key’ => ‘_is_ns_featured_post’, ‘meta_value’ => ‘yes’ ) );

That’s it. You can play with/include the extra parameters of the WP_query, e.g. you may want to include “&orderby=date” and “&posts_per_page=4”. (Hint: the image in this post shows a snippet of how I used the WP_query . Click to enlarge.)

 

Post Media Link

Gabor Por