• Hello.

    I was wondering if anyone knew of an easy way to do this, or if there’s a plugin that will do this. Basically I want to create a series of pages with custom headers for each group, and then have each of those pages slowly be populated with content that will be marked by the categories.

    An example:

    I make a header called Current Materials

    Under it I want three links to appear. In link one, called Current Documents, I want every new blog post that is marked with the Current Documents category to populate this page.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can just do this with categories. Make your main category “Current Materials” and then put in subcategories. When you write your posts, be sure to mark them in the proper category.

    Then set your theme to display whatever header you want for each category.

    Thread Starter cromination

    (@cromination)

    I understand how to make subcategories within categories. However what I want to do is make 3 of the categories fall under one header with a simple <h2> </h2> tag to define the header, and then 3 of the categories to fall under that. Then another 3 categories to fall under a different header. I’ve seen PHP calls for the entire categories section, but I was wondering about how to break it up so that certain categories are called under certain titles.

    Thanks much!

    I/m not sure what you want – can you explain it any better?

    This is from http://codex.wordpress.org/The_Loop

    <!-- Start the Loop. -->
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <!-- The following tests if the current post is in category 3. -->
     <!-- If it is, the div box is given the CSS class "post-cat-three". -->
     <!-- Otherwise, the div box will be given the CSS class "post". -->
     <?php if ( in_category('3') ) { ?>
               <div class="post-cat-three">
     <?php } else { ?>
               <div class="post">
     <?php } ?>

    On the other hand, you might be wanting to have all posts from category A in a div to the left of the page, all posts from category B in a div to the right of the page? If so, the only way would be to have two separate loops – loop one in the left div selects all the posts from category A, loop two in the right div selects all the posts from category B

    Thread Starter cromination

    (@cromination)

    This is what I’ve currently got as an example:

    <h2>Current Materials</h2>
    <a href="http://mysite.com/blog/?cat=8">Current Creative</a><br>
    <a href="http://mysite.com/blog/?cat=9">Current Media</a><br>
    <a href="http://mysite.com/blog/?cat=10">Current Research</a>
    
    <h2>Archived Materials</h2>

    etc.

    That loop does sound like what I want to do without having to hard code any of the side links. I’ll give it a shot, thanks for the help!

    Thread Starter cromination

    (@cromination)

    Ah, I figured this out today:

    <?php wp_list_categories('show_count=1&include=8, 9, 10 &title_li=<h2>Current Materials</h2>'); ?>

    This makes life much easier for this too.

    Solved?

    Thread Starter cromination

    (@cromination)

    Yes, thanks much!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Populating new pages with Category posts’ is closed to new replies.