Support » Fixing WordPress » Selecting Posts to Show

  • I am looking to have posts imported from other sites using RSS feed syndication, but I would like the main posts page to only include internally-generated content and have the external content posted on other pages, say one per RSS feed, so there would be “News” (internal), “Legal News” (syndicated from one RSS feed) and “Industry News” (syndicated from another RSS feed).

    Any ideas on how to accomplish this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • It sounds like you want to do some category checking before displaying your Loop.

    I would suggest using query_post to either include or exclude categories, depending on how many categories you have……like this example:

    <?php
       if (is_home()) {
          query_posts("cat=-3");
       }
    ?>

    Note the “cat=-3” this will exclude items from category ID 3 (this is just an example). You can find more about doing this from this Codex page

    You may have to get creative if you have a lot of categories, but after reading that page you should be able to do what you want….

    Thread Starter CaptainBlue

    (@captainblue)

    Thanks! That might well work in terms of working with categories.

    How though would that work with where WordPress is set to display posts?

    In settings at wp-admin/options-reading.php new posts are set to be displayed on one given page. What I’m after is showing posts from Category A on CatA page, Category B on CatB page, etc.

    Would it be a case of writing CatA.php, CatB.php templates and then writing CatA page with CatA template, CatB page with CatB page template and hiding the ‘default’ posts page?

    Or is there a nicer/neater way to do this?

    No Pages are involved in this exercize 🙂
    When clicking on a category name – WP does it for you: displaying only posts in that cat.

    You simply exclude unwanted categories from the index/main/home page (either with the method linked above or with a plugin)

    Further: there is a plugin http://projects.radgeek.com/feedwordpress/
    that can get feeds in multiple categories. READ there the article about making it compatible with 2.5!

    Thread Starter CaptainBlue

    (@captainblue)

    Yes, I’m already using that for syndicating feeds from my blogs to my main one.

    But that puts them all onto the same index/main page. What I want to do is have three separate pages all showing purely one category per page. The only workaround I can think of is to make the secondary pages archives for one category only and somehow exclude them from the main posts page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Selecting Posts to Show’ is closed to new replies.