Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Recent or latest post
- <?php
- $recent_post_number = array( 'numberposts' => 4 );
- $recent_posts = wp_get_recent_posts( $recent_post_number );
- foreach( $recent_posts as $recent ){ ?>
- <?php echo '
- <li>
- <div class="media"> <a href="' . get_permalink($recent["ID"]) . '" class="media-left"> '. get_the_post_thumbnail( $post->ID, 'small' ). ' </a>
- <div class="media-body"> <a href="' . get_permalink($recent["ID"]) . '" class="catg_title"> '. $recent["post_title"]. '</a> </div>
- </div>
- </li>
- '?>
- <?php } wp_reset_query(); ?>
- /*Reference*/
- <h2>Recent Posts</h2>
- https://codex.wordpress.org/Function_Reference/wp_get_recent_posts
- <ul>
- <?php
- $args = array( 'numberposts' => '5' );
- $recent_posts = wp_get_recent_posts( $args );
- foreach( $recent_posts as $recent ){
- echo '<li><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a> </li> ';
- }
- wp_reset_query();
- ?>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement