Wordpress: Recent Posts Widget


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <h3><a href="<?php bloginfo( 'url' ); ?>/blog/">Neues aus dem Sonnenprojekt</a></h3>
  2.  
  3. <ul>
  4. <?php
  5. global $post;
  6. $args = array( 'numberposts' => 5 );
  7. $myposts = get_posts( $args );
  8. foreach( $myposts as $post ) : setup_postdata($post); ?>
  9. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  10. <?php endforeach; ?>
  11. </ul>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.