• Hi, I have just installed a fresh v1.5 – I have a log running on the previous version but I have a new project which I thought might suit v1.5

    My problem at the moment is I want to have a page displaying “news” which I supply as stories assigned catagory “1”.

    I now want another page which will display only stories with category “2”.

    I thought I could use the new <b>Pages</b> functionality to template my separate pages but I can’t seem to find a reliable way to filter just one category per template.

    Hopefully there is a simple relaible hack to do this? Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • For frontpage, use this plugin
    https://boren.nu/downloads/front_page_cats.phps

    I suppose the plugin above can be modified for pages.
    Otherwise, create another loop in pages
    https://codex.www.ads-software.com/The_Loop#Advanced_Use

    Thread Starter monkeynotes

    (@monkeynotes)

    Thanks this works great – no need for the plugin – just do this:

    <!-- build first query loop-->
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!--set special selective loop in this instance, filter Cat=News and display 1 post-->
    <?php query_posts("category_name=News&showposts=1"); ?>
    <?php while (have_posts()) : the_post(); ?>
    <!-- Do your story stuff here -->
    <?php endwhile; ?>
    <?php endwhile; ?>

    I imagine I have not done this in the most elegant fashion but it works perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Single categories’ is closed to new replies.