Display Random Posts from Specific Categories
I’ve been searching through the codex for a solution and have yet to find something to suit my needs. Basically what I’m looking to do is run 2 different loops in index.php, one for categories 8 and 9 and one for all the other categories. At this point I am able to display 3 posts in the one loop, however the only sort options for get_posts are ascending or descending order.
I tried a few plugins but haven’t been able to get them to display more than just the title. Without further delay, here is the code.
You can see what I’m trying to do, obviously “orderby=rand()” does not work. So now it just shows the last 3 posts by entry date. Does anyone have suggestions?
if ( have_posts() ) :
while ( have_posts() ) : the_post();
<img src="../images/intro<?php the_ID(); ?>.jpg" />
<h2><?php the_title(); ?></h2>
<div class="intro-excerpt"><?php the_excerpt(); ?></div>
- The topic ‘Display Random Posts from Specific Categories’ is closed to new replies.