Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Daniel web

[Resolvido] Exibindo 4 últimos posts

Recommended Posts

Olá pessoal, boa tarde!

 

Tenho um código que exibe os posts de uma determinada categoria, mas ele exibe apenas o último post, queria exibisse os últimos 4 posts. Alguém pode me ajudar?

 

<?php if (is_home()) { query_posts("category_name=blog"); } ?>
                             <?php if ( have_posts() ): while( have_posts() ): the_post(); ?>
                             <a href="<?php the_permalink(); ?>" title="<?php esc_attr( the_title() ); ?>">
                             <h1><?php the_title(); ?></h1>
                             <?php the_content(); ?>
                             </a>
                             <?php endwhile; ?>
                             <?php else: ?>
                             <?php endif; ?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Isso é código do wordpress, não seria melhor você postar na área de wordpress ? lá a galera tem mais conhecimento, e com certeza, vai poder te ajudar. Qualquer coisa fala, que eu te movo pra lá.

 

Oops! Pode mover.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá pessoal, boa tarde!

 

Tenho um código que exibe os posts de uma determinada categoria, mas ele exibe apenas o último post, queria exibisse os últimos 4 posts. Alguém pode me ajudar?

 

<?php if (is_home()) { query_posts("category_name=blog"); } ?>
                             <?php if ( have_posts() ): while( have_posts() ): the_post(); ?>
                             <a href="<?php the_permalink(); ?>" title="<?php esc_attr( the_title() ); ?>">
                             <h1><?php the_title(); ?></h1>
                             <?php the_content(); ?>
                             </a>
                             <?php endwhile; ?>
                             <?php else: ?>
                             <?php endif; ?>

Daniel web.

você tem mais que 4 posts da categoria "blog"?

Para limitar em 4 você pode incluir 'showposts=4'.

Por exemplo, eu uso:

<?php query_posts('showposts=4', 'orderby'); ?>

Para exibir os últimos 4, do mais novo para o mais velho.

Abc.

[els]

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá pessoal, boa tarde!

 

Tenho um código que exibe os posts de uma determinada categoria, mas ele exibe apenas o último post, queria exibisse os últimos 4 posts. Alguém pode me ajudar?

 

<?php if (is_home()) { query_posts("category_name=blog"); } ?>
                             <?php if ( have_posts() ): while( have_posts() ): the_post(); ?>
                             <a href="<?php the_permalink(); ?>" title="<?php esc_attr( the_title() ); ?>">
                             <h1><?php the_title(); ?></h1>
                             <?php the_content(); ?>
                             </a>
                             <?php endwhile; ?>
                             <?php else: ?>
                             <?php endif; ?>

Daniel web.

você tem mais que 4 posts da categoria "blog"?

Para limitar em 4 você pode incluir 'showposts=4'.

Por exemplo, eu uso:

<?php query_posts('showposts=4', 'orderby'); ?>

Para exibir os últimos 4, do mais novo para o mais velho.

Abc.

[els]

 

Obrigado. Consegui.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.