How to display thumbnail and excerpt of a page on homepage?

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

<?php 
$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!

1 Answer
1

<?php $post_id = 50; // assign post id
                $queried_post = get_page($post_id);
                if(is_home()) {  ?>
                <div class="product_title"><h3><a href="https://wordpress.stackexchange.com/questions/72514/<?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  } ?>

Leave a Comment