• Closed
  • Jon Wiederspan
    Spectator
    January 20, 2014 at 9:56 am #8240

    I used the three column dynamic home page where the center is the blog listing. It lists all of the posts in all categories, though. Can I limit it to only show the categories I want to have there? I checked the Blog settings in the evolve section of admin but can’t see anything to set which posts are shown.

    Roman
    Spectator
    Posts: 3147
    January 20, 2014 at 11:01 am #9006

    you could edit the content-blog.php file and change this line (2x):

    Code:
    $wp_query->query(‘posts_per_page=6′.’&paged=’.$paged);

    to something like:

    Code:
    $wp_query->query(‘category_name=staff,news&posts_per_page=6′.’&paged=’.$paged);

    change the category names per your needs

    Jon Wiederspan
    Spectator
    Posts: 1
    January 20, 2014 at 11:37 pm #9007

    Thank you for the suggestion. I made the change in both places (2-3 column and 1 column) but it doesn’t appear to have changed anything on the site. I restarted apache to make sure the changed php file was loaded but nothing. It is still showing all posts from all categories on the main page. I changed the posts_per_page as well because I only want three, but that didn’t affect anything either. It doesn’t even change how many entries show if I click on a category link directly to go to a page with all blog entries from that category.

    It looks to me (and I’m not very good with php) like index.php is generating the main page content and it doesn’t appear to be using a WP_Query object to limit the posts that are returned. Do you think I could modify index.php to use a query?

    Roman
    Spectator
    Posts: 3147
    January 21, 2014 at 11:20 am #9009

    you need to have set the blog page with Blog template when you setting the blog page