I have tried a code posted here>>Custom Post Type: Get most recent permalink

But the thing is-it is showing only one post from the recent and without get_the_title,,, can anyone help me to achieve, upto 10 posts' Title and permalink of custom post type.

I am googling from about 1 hour.. Please anyone help me

  • 2
    Please .... show you full code here instead of linking to a tutorial. This is lazy and just adds to the number of questions that suffer from link rot
    – kaiser
    Dec 17, 2013 at 15:37

3 Answers 3


The answer is essentially in Codex!

<h2>Recent Posts</h2>
    $recent_posts = wp_get_recent_posts(array('post_type'=>'book'));
    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> ';

The only thing I did was add an argument to search for the book post type instead of the default post type.

And this is probably a duplicate of this question anyway, but the system won't let me mark it as such.


Assuming you know how to use WP_Query, you can use following code to get recent 10 posts for any custom post type .

$args = array(
    'post_type' => 'your-custom-post-type',
    'orderby' => 'date',
    'order' => 'DESC',
    'posts_per_page' => 10
$query = new WP_Query( $args ); 

You can use this code to get recent posts

$recent_posts = get_posts(  array( 'posts_per_page' => 1, 'orderby'  => 'post_date', 'order'=> 'DESC', 'post_type' =>  array('camp','cruise','competition','combine')));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.