Lead and Previous Posts
-
I want to display 2 lead posts with a fully summary from a specific category with 4 of the most recent previous posts to be displayed below showing only titles.
This can be done. I used to have the code.
It is now being done on https://blog.gluedideas.com/
I have tried and tried to get the code working but I can’t. I need the code to display 2 or whatever other number of lead posts and differentiate them from previous posts.
What code should I use in my loop?
I have managed to take some code from Glued Ideas Subtle theme, but I am pretty sure it needs the subtly theme to work:
<!-- open loop_articles --><div id="loop_articles"> <?php query_posts('category_name=events'); if (have_posts()) : $iLeadIndex = 0; while (have_posts()) : the_post(); $iLeadIndex++; $sPostClass = ''; $bShowContent = true; if ($iLeadIndex <= $aOptions['lead_count']) { $sPostClass .= ' lead'; $bShowContent = true; } else { $sPostClass .= ' summary'; $bShowContent = false; } if ($iLeadIndex == $aOptions['lead_count'] + 1) { echo ('<h2>Previous Articles</h2>'); } ?> <!-- open post --><div> <h3> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> </h3> <?php if ($bShowContent) : ?> <!-- open content --><div class="content"> <?php the_content(''); ?> <!-- close content --></div> <?php endif; ?> <!-- close post --></div> <?php endwhile; else: ?> <h2>Oops - There's Nothing Here</h2> <p>It looks like the blog owner hasn't written anything yet!</p> <?php endif; ?> <!-- close loop_articles --></div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Lead and Previous Posts’ is closed to new replies.