• Boa noite e feliz 2014, Comunidade WordPress!

    Seguinte, estou tentando criar um portal de notícias, e para isto utilizando o plugin Lead Manager [aquele do Xelemê]. Só tô totalmente perdido com uma dúvida, que procurei aqui do Fórum alguma resposta sobre, mas não encontrei: é correto eu repetir vários loops num mesmo arquivo? No caso em questão, só no index.php, eu inseri três loops, como vocês podem observar abaixo e respondem se isso vai fazer com que meu servidor caia ou se não tem problema algum. Obrigado!

    <?php get_header(); ?>
    
    			<section role='main'>
    				<section id='sessao-principal'>
    <?php while ( $covers->have_posts(1) ) : $covers->the_post(1) ?>
    					<article class=''>
    						<header>
    							<strong>
    								<a href='<?php the_permalink() ?>' rel='bookmark' title='<?php the_title_attribute(); ?>'><?php $covers->the_title(); ?></a>
    							</strong>
    							<h1><?php $covers->the_excerpt(); ?></h1>
    						</header>
    					</article>
    <?php endwhile; ?>
    				</section>
    				<section id='sessao-secundaria'>
    <?php while ( $covers->have_posts(2) ) : $covers->the_post(2) ?>
    					<article class=''>
    						<header>
    							<strong>
    								<a href='<?php the_permalink() ?>' rel='bookmark' title='<?php the_title_attribute(); ?>'><?php $covers->the_title(); ?></a>
    							</strong>
    							<h1><?php $covers->the_excerpt(); ?></h1>
    						</header>
    					</article>
    <?php endwhile; ?>
    				</section>
    				<section id='sessao-auxiliar'>
    <?php while ( $covers->have_posts(3) ) : $covers->the_post(3) ?>
    					<article class=''>
    						<header>
    							<strong>
    								<a href='<?php the_permalink() ?>' rel='bookmark' title='<?php the_title_attribute(); ?>'><?php $covers->the_title(); ?></a>
    							</strong>
    							<h1><?php $covers->the_excerpt(); ?></h1>
    						</header>
    					</article>
    <?php endwhile; ?>
    				</section>
    			</section>
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
Visualizando 1 resposta (de um total de 1)
  • Moderador Claudio Sanches

    (@claudiosanches)

    Desta forma que você esta fazendo não funciona, have_posts() e the_post() não aceitam parâmetros e nem iria funcionar para chamar mais de alguma coisa… Provavelmente você já sabe disso, mas avisando caso alguém caia neste tópico e tente copiar.

    Enfim, você pode usar WP_Query para colocar quantos loops você quiser na sua página, não tem nada errado com isso.

Visualizando 1 resposta (de um total de 1)
  • O tópico ‘Vários loops’ está fechado para novas respostas.