Forums

Second featured post - How to? (5 posts)

  1. prosperewebitor
    Member
    Posted 2 months ago #

    I'm currently using Suhweet 1.0 as my theme. The theme is already coded to do a featured post, but I'm wondering how I can add a second one? Is it possible to have two or more? Please let me know.

    Thanks

    C

  2. jonimueller
    Member
    Posted 2 months ago #

    The first feature post pulls from a specific category, correct? You'd just need to create a second category for the Second Feature item and copy the code, but change the category ID to the newly created one.

    And of course you can style it however you like.

    Make sense?

  3. prosperewebitor
    Member
    Posted 2 months ago #

    Yeah. I tried a second category and it didn't work. I also tried changing the coding of the featured to displaying 2 articles, but at that time, the newer feature article is posted twice, once as a feature and again as "recent articles".

    Thanks!

    Cynthia

  4. jonimueller
    Member
    Posted 2 months ago #

    Well, Cynthia, here's the code from my web site, where I've got a changing welcome message (in its own category, set to pull the latest one only), two latest site launches (their own category), and two latest news items (their own category). I've put XX, YY and ZZ where my category IDs were. You can ignore the styling too, but I put it there to illustrate the placement of the loops (there are three here).

    <!-- WELCOME MESSAGE ALWAYS ON TOP -->
    <div id="welcome">
    <?php query_posts('cat=XX&showposts=1'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2 class="headline"><?php the_title(); ?></h2>
        <?php the_content(); ?>
    <!--
    <?php trackback_rdf(); ?>
    -->
    <?php endwhile; else: ?>
    <?php endif; ?>
    </div><!-- /welcome -->
    
    <!-- RECENT LAUNCHES LATEST TWO -->
    <div id="site-launch">
    <h2 class="headline">Recently Completed Projects</h2>
    <?php query_posts('cat=YY&showposts=2'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    
    <div class="meta"><?php the_date(); ?><br />
    <strong>Filed Under:</strong>  <?php the_category(',') ?> </div>
    <div class="storycontent">
    <?php the_content(__('More &raquo;')); ?>
    </div><!-- end STORYCONTENT -->
    <?php endwhile; else: ?>
    <?php endif; ?>
    </div><!-- /site-launch -->
    
    <!-- SITE NEWS LATEST TWO -->
    <div id="news">
    <h2 class="headline">Latest News</h2>
    <?php query_posts('cat=ZZ&showposts=2'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h4><?php the_title(); ?></h4>
    <div class="meta"><?php the_date(); ?></div>
    <div class="storycontent"><?php the_excerpt(); ?><br />
    <strong><a href="<?php the_permalink() ?>">More &raquo;</a></strong></div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    <?php endwhile; else: ?>
    <?php endif; ?>
    </div><!-- /news -->
  5. jonimueller
    Member
    Posted 2 months ago #

    And don't know if you've read this yet, but toward the end, right about where the subtitle The End Result is, you'll find some code that helps to avoid duplicate posting on the same page, like what you described above.

    http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

Reply

You must log in to post.

About this Topic