WordPress.org

Forums

Multiple content blocks
[resolved] Block not displaying after second loop. (2 posts)

  1. iamthez
    Member
    Posted 2 years ago #

    Simply put, this works:

    <div id="content-1">
    			<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    					<h1><?php the_content();?></h1>
    			<?php endwhile; ?>
    
    		</div>
    
    		<div id="content-2">
    			<?php the_block('Guest Lectures'); ?>
    		</div>
    
    		<div id="sub-pages">
    			<?php
    			$query = 'post_type=page&post_parent=9&order=ASC';
    			$queryObject = new WP_Query($query);
    			// The Loop...
    			if ($queryObject->have_posts()) {
    				while ($queryObject->have_posts()) {
    					$queryObject->the_post(); ?>
    
    				<h4><?php the_title(); ?></h4>
    				<?php the_excerpt(); ?>
    
    			<?php } } ?>

    And this does not:

    <div id="content-1">
    			<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    					<h1><?php the_content();?></h1>
    			<?php endwhile; ?>
    
    		</div>
    
    		<div id="sub-pages">
    			<?php
    			$query = 'post_type=page&post_parent=9&order=ASC';
    			$queryObject = new WP_Query($query);
    			// The Loop...
    			if ($queryObject->have_posts()) {
    				while ($queryObject->have_posts()) {
    					$queryObject->the_post(); ?>
    
    				<h4><?php the_title(); ?></h4>
    				<?php the_excerpt(); ?>
    
    			<?php } } ?>
    
    		<div id="content-2">
    			<?php the_block('Guest Lectures'); ?>
    		</div>

    Any ideas?

    http://wordpress.org/extend/plugins/multiple-content-blocks/

  2. Trendwerk
    Member
    Plugin Author

    Posted 2 years ago #

    You should reset to the main query after your custom loop. Look at http://codex.wordpress.org/Function_Reference/wp_reset_query for more info.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multiple content blocks
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic