Try it with something like this:
<?php
$featured= & get_post( $dummy_id = 834 );
$featured_url= get_permalink($featured->ID);
?>
<a href="<?php echo $featured_url; ?>" title="<?php echo 'latest review about: '.$featured->post_title; ?>">Latest Review</a>
<?php if ( has_post_thumbnail($featured->ID)) : ?>
<a href="<?php echo $featured_url; ?>">
<?php echo get_the_post_thumbnail( $featured->ID, 'thumbnail'); ?>
</a>
<?php endif; ?>
<a href="<?php echo $featured_url; ?>" title="<?php echo 'latest review about: '.$featured->post_title; ?>"><?php echo $featured->post_title; ?></a>
<?php
$excerpt_length = 40;
$content = $featured->post_content;
$content = strip_shortcodes($content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
$excerpt = explode(' ', $content);
if (count($excerpt) > $excerpt_length) {
$excerpt = implode(' ', array_slice($excerpt, 0, $excerpt_length)) . '...';
} else {$excerpt = $content; }
$excerpt = apply_filters('the_content', $excerpt);
echo $excerpt;
?>
<a href="<?php echo $featured_url; ?>" title="<?php echo 'latest review about: '.$featured->post_title; ?>">Read full review</a>
Change the $dummy_id = 834 to the post ID you want to show.
and change $excerpt_length = 40; to change the excerpt length
Works brilliantly 🙂
The only thing is the thumbnail doesn’t seem to show. I’ve activated get_post_thumbnail and I can choose the image, it just doesn’t show up.
I am putting all of this in a blank sidebar, does it need to be encapsulated in anything to work?
Thanks again
This doesn’t have to be in the loop. The strange thing is that it does work on my testserver. Are you sure your post has a post thumbnail assigned to it.
All good, a restart of XAMPP fixed it for some reason, thanks!