Forums

Used to use two loops, how do I do this now in 2.8? (6 posts)

  1. kickass
    Member
    Posted 4 months ago #

    This home.php template code works just ducky in older versions but doesn't work in 2.8. How do I change the code to give me the same result in 2.8?

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div><!-- end entry -->
    		</div><!-- end post -->
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    
    		<h3 class="news">Most Recent News</h3>
    
    <?php query_posts('posts_per_page=3'); ?>
      <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); ?>
      <div class="post<?php sticky_class(); ?>">
        <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="PermaLink to <?php the_title(); ?>">
          <?php the_title(); ?>
          </a></h2>
        <p class="small">
        <?php the_time('F jS, Y') ?> by
        <?php the_author() ?>
        </p>
        <div class="entry">
          <?php  the_excerpt('more . . .  &raquo;'); ?>
        </div>
        <p class="postmetadata">Posted in
          <?php the_category(', ') ?>
          <strong>|</strong>
          <?php edit_post_link('Edit','','<strong>|</strong>'); ?>
          <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
        </p>
        <!--
    				<?php trackback_rdf(); ?>
    				-->
      </div>
      <?php endwhile; ?>
      <?php else : ?>
      <h2 class="center">Not Found</h2>
      <p class="center">
        <?php _e("Sorry, but you are looking for something that isn't here."); ?>
      </p>
      <?php endif; ?>
  2. esmi
    Member
    Posted 4 months ago #

    It should still work in 2.8. What's the problem?

    Maybe you just need to take another look at Multiple Loops?

  3. davidmihm
    Member
    Posted 4 months ago #

    I'm having the exact same problem. Multiple loops on the homepage appear buggy in 2.8...any ideas...?

  4. davidmihm
    Member
    Posted 4 months ago #

    So, at least the solution to my personal problem on the homepage had to do with the "Stealth Publish" plugin, which looks not to be 100% compatible with 2.8. As soon as I removed the custom fields from those posts associated with this plugin, they appeared on the homepage as before.

  5. jbbrwcky
    Member
    Posted 4 months ago #

    What kinds of problems occur with this code? There's so many ways to get the loops to work, and esmi mentioned that Multiple Loops page which helps a lot.

    Might try using update_post_caches($posts) if it's a plugin that's causing the errors.

  6. davidmihm
    Member
    Posted 4 months ago #

    What kinds of problems occur with this code?

    What was supposed to be contained in the loops just don't show up...it's like WP just ignores they're even there...but as I said, as soon as I removed the custom field on those posts that was created by the plugin, all problems went away.

Reply

You must log in to post.

About this Topic