How to put the "old posts" and "recent posts" option in this code?

Asked

Viewed 370 times

1

The maximum posts that appear by the code of my blog are 6, but I would like to put the options of "previous posts" and "recent posts", the way I had managed had been strange because it did not appear only the thumbnail and the title, but yes the whole news. if you can help me here is the code.

  <?php  
  $args = array(
                'numberposts'     => 1,
                'offset'          => 0,
                'orderby'         => 'post_date',
                'order'           => 'DESC');

  $posts_array = get_posts( $args );

  foreach( $posts_array as $post ) :  setup_postdata($post); ?>
       <div class="destaque"><?php the_post_thumbnail( 'destaque-thumb' ); ?><br />
         <p style="font-size:10px;"><?php echo get_the_date(); ?></p>
         <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> 
     </div>
  <?php endforeach; ?>

 <?php  
 $args = array(
               'numberposts'     => 6,
               'offset'          => 1,
               'orderby'         => 'post_date',
               'order'           => 'DESC');

  $posts_array = get_posts( $args );

  foreach( $posts_array as $post ) :  setup_postdata($post); ?>
           <div class="noticia"><?php the_post_thumbnail( 'noticia-thumb' ); ?><br />
             <p style="font-size:8px;"><?php echo get_the_date(); ?></p>
             <p style="font-size:12px;">
                <a href="<?php the_permalink(); ?>">
                <?php the_title(); ?>
                </a>
             </p> 
           </div>
  <?php endforeach; ?>

about the code that shows the entire post is there:

`<div id="conteudo">
    <div id="artigos">

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <div class="artigo">
                <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                <p>Postado por <?php the_author() ?> em <?php the_time('d/M/Y') ?> -  <?php edit_post_link('(Editar)'); ?></p>
                <p><?php the_content(); ?></p>
            </div>            
        <?php endwhile?>
            <div class="navegacao">
                <div class="recentes"><?php next_posts_link('&laquo; Posts antigos') ?></div>
                <div class="anteriores"><?php previous_posts_link('Posts novos &raquo;') ?></div>
            </div>
        <?php else: ?>
            <div class="artigo">
                <h2>Nada Encontrado</h2>
                <p>Erro 404</p>
                <p>Nenhum post foi encontrado.</p>
            </div>            
        <?php endif; ?>

    </div>`
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.