Latest notes wordpress on a separate page



  • How do you put the last tapes on a separate page in wordpress?



  • This code will remove the last five posts.

        <?php
    $args = array( 'posts_per_page' => 5 );
    $lastposts = get_posts( $args );
    

    foreach( $lastposts as $post ){
    setup_postdata($post); // устанавливаем данные
    ?>

    &lt;h2&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
    &lt;?php the_content(); ?&gt;
    
    &lt;?php
    

    }
    wp_reset_postdata(); // сброс
    ?>

    Full documentation for get_posts(); Here. http://wp-kama.ru/function/get_posts




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2