WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello i'm trying to display a Post Title by its ID and its thumb content, I have I code but this displays everything, all I want is post title,its category and a short content of that post. I have a code but it displays all of the contents thanks

share|improve this question
For Display post title inside the loop you can use following
For Post title <?php the_title(); ?>
For Post Short Content <?php the_excerpt(); ?>
For Post Category <?php twentyten_posted_in(); ?>

Or Display post title out side the loop 
use global variable $post <?php global $post; ?>
For Post title <?php $post->post_title; ?>
For Post Short Content <?php $post->post_excerpt; ?>
share|improve this answer
Thanks Sir I have These code all I need now is to echo along the title its excerpt thanks <?php if (empty($pop_posts) || $pop_posts < 1) $pop_posts = 6; $popularposts = "SELECT ID,post_title FROM {$wpdb->prefix}posts WHERE ID='501' OR ID='2043' OR ID='444' OR ID='670' OR ID='1383' OR ID='1954' AND post_status = 'publish' AND post_type = 'post' ORDER BY comment_count DESC LIMIT 0,".$pop_posts; – dekz gimutao Feb 15 '12 at 7:42
$posts = $wpdb->get_results($popularposts); if($posts){ foreach($posts as $post){ $post_title = stripslashes($post->post_title); $guid = get_permalink($post->ID); $popular .= '<li><a href="'.$guid.'" title="'.$post_title.'">'.$post_title.'</a></li>'; } }echo $popular; ?> – dekz gimutao Feb 15 '12 at 7:42
@dekzgimutao code like that should be going in your question, not a comment...much less multiple comments. – mor7ifer Feb 15 '12 at 15:52

Your Answer


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.