Wordpress how can I create multiple loops in the index?

0

I'm trying to create multiple loops in my index in wordpress, I wanted to call the posts as follows:

Postings: showing only 6 posts. Series: Showing only 6 posts. Recent Movies: Showing only 6 posts but with pagination.

I have already tried and managed to get the pagination not working very well when going to page 2 I wanted to show only the last posts but it does pagination in the releases and in the tmb series.

In short, I wanted an equal index of this site: efilmesnarede.com

    
asked by anonymous 16.04.2016 / 22:56

1 answer

0

It's simple, for this Wordpress has the filter array of while( have_posts( ) ) I'm going to go here as the code should be, I commented on it to show you:

<?php
$args = array('showposts'  => 5,  # Quantidade de Posts a serem Mostrados, use -1 para puxar todos!
              'post_status' => 'publish', # PEGA APENAS POSTAGENS PUBLICADAS.
              'category_name' => 'lancamentos'; # PEGA OS POSTS PELA CATEGORIA.
            );

    $wp_query = new WP_Query( $args ); # PEGA OS ARGUMENTOS SETADO ACIMA!

    if(have_posts()) : while(have_posts()) : the_post(); # VERIFICA SE TEM POSTAGENS.
?>

       CÓDIGO QUE DEVE SER REPETIDO FICA AQUI! 

<?php endwhile; endif; # FIM DA VERIFICAÇÃO DE POSTAGENS. # CASO QUEIRA, USE UM ELSE: NO WHILE FICANDO ELSE: ENDWHILE; ENDIF; E NO ELSE COLOQUE O CODIGO 404.
wp_reset_query(); # RESETA O QUERY PARA NÃO TER CONFLITO NOS PRÓXIMO LOOPS ABAIXO ?>

Good luck on your system!

    
23.04.2016 / 18:26