• This might be a stupid question. I’m setting up a blog in which we’ll have daily updates (normal blog posts), features (major pieces), and news items (brief summaries of daily news). I want to have the news items and features display their own narrow sidebar columns and the daily updates display in the main content area of the page. This graphic should be a decent illustration of this (homework would be the news section).

    My basic concept was going to be that each type of post would be a category and that I could somehow get each category to display in a different place. Is this going to be a major hack, or is there an easy way to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Check out query_posts out. I’m pretty sure that by tweaking the options (very easy), you should be able to get what you want.

    You will need to use multiple instances of The_Loop and set each one for the specific categories you want in that place.

    https://codex.www.ads-software.com/The_Loop#Multiple_Loops
    https://codex.www.ads-software.com/The_Loop

    Thread Starter axo1ot1

    (@axo1ot1)

    This was very helpful! Thanks a lot!

    One question to raise the level of compication:

    This particular blog has 3 categories of post. I’ve got my main blog body displaying all of category 1 and excerpts from category 2 , and then in the ‘sidebar’ area I’m listing the 8 most recent category 3 posts (which aren’t being listed in the blog) – I’m using the query_posts object for that.

    Then in a second part of the sidebar I want to have links to the 8 most recent entries from category 2, displayed in a similar way to the entries from category 3. This has proved to be more challenging. The query_posts thing is not working, so I’m using rewind_posts and getting the posts from that category again.

    The thing is, I’m pretty sure that this way the number of items listed in this area will be based on how many items I have the blog displaying (set in the options tab), but I want to limit the number.

    Did that make any sense? Can anyone suggest anything?

    Thread Starter axo1ot1

    (@axo1ot1)

    bump

    I don’t know enough about that to help with doing it that way, but I have a couple of alternate ideas.

    One: Use the category RSS feed and the CG-Powerpack feedreader to display the titles of the most recent 8 posts.
    https://www.chait.net/index.php?p=238
    (You need CG-Powerpack anyway. It is the sliced bread of WordPress plugins.

    Two: Recent Posts plugin: https://dev.wp-plugins.org/browser/recent-posts/

    Three: The Identification Bands theme has code like this that perhaps you could modify as needed. (Perhaps this is what you were already doing that didn’t work, though.):
    <?php
    $today = current_time('mysql', 1);

    if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5")):
    ?>
    <ul>
    <li id="recents">
    <ul>
    <?php
    foreach ($recentposts as $post) {
    if ($post->post_title == '')
    $post->post_title = sprintf(__('Post #%s'), $post->ID);
    echo "<li><a href='?p=$post->ID'>";
    the_title();
    echo '</a></li>';
    }
    ?>
    </ul>
    </li>
    </ul>
    <?php endif; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different Categories in Different Parts of the Page?’ is closed to new replies.