Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Multiple loops in WordPress Re: Multiple loops in WordPress

#91938
sweetissassy
Member

After a lot of frustration, I referred back to the wordpress codex site. I re-wrote the whole section of code and it seems to work properly now. YAY!



// The Query
$the_query = new WP_Query( 'posts_per_page=3' );

// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
// The Title
echo '

the_permalink();
echo '">';
the_title();
echo '

';
// The Author
echo '';
// The excerpt
echo '

';
the_excerpt();
echo '

';
// The date
echo '

';
the_time('F j, Y');
echo '
  ';
comments_popup_link('No Comments', '1 Comment', '% Comments');
echo '

';
endwhile;

// Reset Post Data
wp_reset_postdata();

?>