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

How to display attached thumbnail and excerpt (about 200 words) of a page on homepage?

$page_data = get_page( 401 ); // Get page ID 401
echo '<h3>'. $page_data->post_title .'</h3>';
echo apply_filters('the_content', $page_data->post_content);

I don't know how to display attached image as thumbnail. May be i use mb_substr php function to cut the content to the excerpt.

Sorry, my english is not good. :) Thanks for help!

share|improve this question
i've tried with get_page function. But i can't get the page excerpt & attached thumbnail with it. tks for help. – Bits Hcm Nov 14 '12 at 4:05
Please edit the question and paste the code that you used. – s_ha_dum Nov 14 '12 at 5:25
i've edit and update the question. thanks all very much. :) – Bits Hcm Nov 14 '12 at 6:48
up vote 0 down vote accepted
<?php $post_id = 50; // assign post id
                $queried_post = get_page($post_id);
                if(is_home()) {  ?>
                <div class='product_title'><h3><a href="<?php echo get_page_link($post_id); ?>"><?php echo $queried_post->post_title;  ?></a></h3></div>                    
                <div class='product_image_location'><?php echo get_the_post_thumbnail( $post_id); ?></div>
                <div class='description_product'>
                <?php echo $queried_post->post_content;  ?></div>
            <?php  } ?>
share|improve this answer
You should really start with the is_home() check. Otherwise you would send the extra query on each request. – toscho Nov 14 '12 at 8:27

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.