Forums

[resolved] Show only posts from one category? (6 posts)

  1. Rohaq
    Member
    Posted 3 years ago #

    I want my frontpage to display only posts from my 'Blog' category, and to list posts from other categories on another page. I've tried using the in_category('x') check in the while loop for my theme, but it doesn't seem to be able to tell the difference between the posts.

    Edited code is as follows:
    [code]<?php while (have_posts() && in_category('4') ) : the_post(); ?>[/code]

    Shows all of my posts, regardless of category, if set to '4', shows nothing if set to anything else :(

    Can anybody suggest as to how I can fix this?

  2. Chris_K
    Member
    Posted 3 years ago #

    There are some plugins that would help simplify doing what you're after.

    For instance, have a look at Advanced Category Excluder.

  3. Rohaq
    Member
    Posted 3 years ago #

    That seems to work pretty well, thanks!

    Second problem then: I need to list posts that fall under a particular category on a page. Is there a plugin that'll do this?

  4. Rohaq
    Member
    Posted 3 years ago #

    Ah, found a plugin that does exactly what I wanted

    PostLists

    Consider this resolved, thanks for your help!

  5. Chris_K
    Member
    Posted 3 years ago #

    Not sure about that plugin, but Category pages are a built-in feature of WordPress (and Category_Templates are nifty too)

    Regardless, glad to hear you got it all sorted. Happy blogging!

  6. Rohaq
    Member
    Posted 3 years ago #

    I know what you mean, but it wasn't quite what I was looking for in terms of navigation and design; I wanted to use categories to create different 'post areas' on the site, and then split these areas with actual editable pages, rather than a generic 'Categories' list, and without using customised themes for each page.

    Solved now, anyway :)

Topic Closed

This topic has been closed to new replies.

About this Topic