Wordpress Snippets

Display First Few Characters Of A WordPress Post Outside The Loop

<?php echo apply_filters( 'the_content', wp_trim_words( strip_tags( get_post_field('post_content', $recent["ID"]) ), 55 ) ); ?>

where
$recent["ID"]
is of the ID of the post.

If you are already querying the post and already have a WP_Post object, you can simply use this:

<?php echo apply_filters( 'the_content', wp_trim_words( strip_tags( $recent["post_content"] ), 55 ) ); ?>

For an example, see this: Query Anything On WordPress Anywhere

Hire Us. Or just say Hi!
Need a job? Apply to get one.