How to specify the category displayed on the home page?

edited July 2014 in Quality

Hi,


When I enable the blog section on the home page.   All the  recent posts will be  displayed in this section.

May I specify a category?  I mean only the posts in this category are displayed in the homepage.


Can you give me some fixing code?  I can modify the code myself.

Thanks.



Comments

  • Hi

    First I would like to know the purpose of displaying category.

    If your purpose is to display three posts of your choice on the front page than no need to add category filter, you can use post reorder plugin and arrange your top three posts accordingly.

     ===Or===

    If you want it by choice than 

    Create a child theme first and copy paste the file index-blog.php  in it , find the line of code(line no 24)
    $args = array( 'post_type' => 'post','posts_per_page' =>3,'post__not_in'=>get_option("sticky_posts"));

    and add an attribute in an array above 'cat' => 'your category id'


    I hope I made my point clear.

    Thanks
    Priyanshu
  • thanks,  it works now.

    For the home page, I don' t want all the posts in my site displayed here.
  • Which method you followed
  • Hi,

    any update here ?

    Thank's

    Sunil
Sign In or Register to comment.