Can`t make more than one loop work in one template
-
Hello
I need to create at least 3 loops in one template with post types, the first one is working perfectly, but when I place a second in the same template it doesn`t work correctly.
– It should show 2 posts and shows only one;
– Doesn′t print the information it should (and the first one does and I`m using the same code for both);
– Also kills the <?php get_footer() ?> and if I try to get a sidebar;I`v tried to separate the code in a Get_template_part.. and the problem persists.
This is the code I’m using for both loops changing only funcion names and args
<?php $args = array( 'post_type' => 'noticias', 'posts_per_page' => 6 ); $noticias = new WP_Query ( $args ); ?> <div class="row"> <?php if (have_posts() ) : while( $noticias->have_posts()) : $noticias->the_post(); ?> <div class="small-12 large-4 columns"> <div class="panel noticia-home-item"> <div class="thumbtitle group"> <p><?php the_field( 'noticias' ); ?></p> <div class="thumbnail thumb-noticias-home"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a> </div> <h5> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_title(); ?> </a> </h5> <p class="data">Publicado em <?php $data = DateTime::createFromFormat('Ymd',get_field('data')); echo $data->format('d/m/y'); ?></p> <div class="resumo"><?php the_excerpt(); ?> </div> <div class="saiba-mais"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Saiba mais..</a></div> </div><!--thumb title--> </div><!--panel--> </div><!--large-4--> <?php endwhile; endif; ?> <?php wp_reset_postdata(); ?> </div><!--row-notícias-->
The url is this – https://www.ufrgs.br/tsrs/telessauders/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Can`t make more than one loop work in one template’ is closed to new replies.