Creating an excerpt without images
-
Looking to create an excerpt from a specific category. However, the code is pulling the image code from the post instead of the plain text. I want to filter out all html tags and just get plain text. Must be missing something simple.
Code is as follows:
<?php $latestPosts = new WP_Query(); $args = array('post_type' => 'post', 'order' => 'DESC', 'posts_per_page' => 1, 'cat' => '11' ); $latestPosts->query($args); ?> <?php foreach($latestPosts->posts as $blogPost): ?> <?php $authorInfo = get_userdata($blogPost->post_author); ?> <p> <strong><?php echo $blogPost->post_title; ?></strong><br/> <?php echo date('F d, Y', strtotime($blogPost->post_date)); ?> | POSTED BY <?php echo $authorInfo->user_login; ?> <?php echo strip_tags(substr($blogPost->post_content, 0, 110)); ?><br /> <a href="<?php echo get_permalink($blogPost->ID); ?>">read more...</a> </p> <?php endforeach; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Creating an excerpt without images’ is closed to new replies.