Forums

[resolved] query_posts loops + page content (4 posts)

  1. shakingpaper
    Member
    Posted 3 years ago #

    I am having an issue with showing query_post lists and calling the page content (using an custom template). Basically, the lists show up but not the page content.

    The query_posts get called first:

    <ul id="events">
    	<?php query_posts('cat=3&amp;showposts=2'); ?>
    	<?php while (have_posts()) : the_post();
    	if( $post->ID == $do_not_duplicate ) continue; ?>
    	<li class="news_post_1" id="post-<?php the_ID(); ?>">
    	<h2><?php if (strlen($post->post_title) > 25) { echo substr(the_title($before = '', $after = '', FALSE), 0, 25) . '...';} else {the_title();} ?></h2>
    	<?php the_time('l j F, Y') ?> | <a href="<?php echo get_permalink(); ?>">More...</a>
    
    	</li>
    	<?php endwhile; ?>
    
            </ul>
    
    <ul id="news">
    	<?php query_posts('cat=4&amp;showposts=2'); ?>
    	<?php while (have_posts()) : the_post();
    	if( $post->ID == $do_not_duplicate ) continue; ?>
    	<li class="news_post_1" id="post-<?php the_ID(); ?>">
    	<h2><?php if (strlen($post->post_title) > 25) { echo substr(the_title($before = '', $after = '', FALSE), 0, 25) . '...';} else {the_title();} ?></h2>
    	<?php the_time('l j F, Y') ?> | <a href="<?php echo get_permalink(); ?>">More...</a>
    
    	</li>
    	<?php endwhile; ?>
    	</ul>

    Then a few divs later I need the page content to show up but have tried a number of things and all I get is a blank page.

    Any help would be great

  2. shakingpaper
    Member
    Posted 3 years ago #

    Can anyone help with this? Really need some help.

  3. MichaelH
    Volunteer
    Posted 3 years ago #

    Might use get_posts with setup_postdata rather than query_posts for your two loops.

    Examples:
    http://www.daobydesign.com/blog/2007/07/modifying-wordpress-front-page/

  4. shakingpaper
    Member
    Posted 3 years ago #

    That did the trick - thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.