• Creator
    Topic
  • #8240

    Jon Wiederspan
    Spectator
    Been thanked: 0 times

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
Replies
  • Roman
    Keymaster
    Post count: 2538
    Been thanked: 29 times
    #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
    Post count: 1
    Been thanked: 0 times
    #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
    Keymaster
    Post count: 2538
    Been thanked: 29 times
    #9009 |

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

Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.