Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to display post details by ID on front page template (front-page.php).

On the front page I want to display the post’s title, excerpt & featured image. I have tried to do that but no idea on how I should be doing that.

Is there any function in WordPress that can be used to do it?

share|improve this question
1  
Please show us your code and what you've tried so far. –  kaiser Oct 25 '12 at 13:22
add comment

1 Answer 1

up vote 3 down vote accepted

You can use get_post for that

Example:

<?php
$post = get_post($id); //assuming $id has been initialized
setup_postdata($post);

// display the post here
the_title();
the_excerpt();
the_post_thumbnail();

wp_reset_postdata();
?>
share|improve this answer
    
hey thanks, that worked very well. –  Krunal Oct 25 '12 at 14:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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