wordpress_add

Wednesday, 18 September 2013

With out using Widgets How to get recent post in any page Of WordPress..!!!

Dr-wordpress :This is the method to show the most recent post at any web page of wordpress.

Just paste this code to that File where you want to display the recent POST, Use and enjoy...:).

<?php

     $args = array(
    'numberposts' => 10,
    'offset' => 0,
    'category' => 0,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'include' => ,
    'exclude' => ,
    'meta_key' => ,
    'meta_value' =>,
    'post_type' => 'post',
    'post_status' => 'draft, publish, future, pending, private',
    'suppress_filters' => true );

    $recent_posts = wp_get_recent_posts( $args, $output = ARRAY_A );
?>
 foreach( $recent_posts as $recent ){
  echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
 }

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

No comments:

Post a Comment