Suporte » Temas e templates » Problemas com loop

  • Resolvido marcelomoreles

    (@marcelomoreles)


    Boa tarde,

    Estou precisando de uma ajuda no loop do template home.php.

    Tenho um loop onde chamo o resumo de uma página e em seguida uma lista com os posts de uma categoria. Em seguida, numa outra div faço a mesma coisa. Acontece que a segunda div está entrando no loop da primeira desconfigurando meu template.

    Como posso resolver?

    Segue o código:

    <div class="three_column margin_r35 vertical_divider" style="border:1px solid red;">
            	<?php query_posts('page_id=4'); ?>
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                    <h2><?php the_title(); ?></h2>
    
                    <div class="image_wrapper"><a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/templatemo_image_03.jpg" alt="Apresentação" /></a></div>
                        <?php the_excerpt(''); ?>
                        <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>	  	
    
    		        <div class="button float_r" style="margin-bottom:15px;"><a href="?page_id=4">Leia mais</a></div>
    
            	</div>
                <?php endwhile; endif; ?>
    
              <div class="divider" style="clear:both"></div>
    
              <h2>Notícias</h2>
              	<?php query_posts("category_name=Noticias&posts_per_page=3"); ?>
              	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
                  <ul class="item_list">
    
    <li><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
                  <?php endwhile; endif; ?>
                  <div class="button float_r"><a href="?cat=06">Leia mais</a></div>
    
            	</div>
            </div>
    
            <!-- segunda coluna -->
    
      		<div class="three_column2 margin_r35 vertical_divider">
            	<?php query_posts('page_id=6'); ?>
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                    <h2><?php the_title(); ?></h2>
    
                    <div class="image_wrapper"><a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/templatemo_image_01.jpg" alt="Áreas de atuação" /></a></div>
                    <?php the_excerpt(''); ?>
                    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
              		<div class="button float_r" style="margin-bottom:15px;"><a href="?page_id=6">Ver todas</a></div>
    
                 </div>
    
              <?php endwhile; endif; ?>
    
              <div class="divider" style="clear:both"></div>
    
              <h2>Artigos</h2>
    
              <?php query_posts("category_name=Artigos&posts_per_page=3"); ?>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
                  <ul class="item_list">
    
    <li><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
              	<?php endwhile; endif; ?>
                <?php wp_reset_query(); ?> 
    
              <div class="button float_r"><a href="?cat=06">Leia mais</a></div>
              </div>
    
            </div>
  • O tópico ‘Problemas com loop’ está fechado a novas respostas.