If I understand your question right, a function that truncates your text after stripping HTML is what you need.
What about using wp_trim_words():
<?php while($breakingnews->have_posts()) : $breakingnews->the_post(); ?>
<a href="https://wordpress.stackexchange.com/questions/253344/<?php the_permalink(); ?>"><?php the_post_thumbnail('post-image'); ?></a>
<div class="leadnewsboxtitle">
<h2><a href="https://wordpress.stackexchange.com/questions/253344/<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php echo wp_trim_words( get_the_content(), 60, '...' ); ?></p>
</div>
<?php endwhile; ?>
General usage:
wp_trim_words( string $text, int $num_words = 55, string $more = null )
Related Posts:
- get_post_gallery_images returns thumbs . I want full size
- Media Upload Folder – how to manage
- Wrong image dimensions in Insert Media after add_image_size()
- Remove P tags from images
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Upload multiple images in a custom metabox
- How can I hide media library images from general users?
- WordPress speed slow after .5 million single image post via wp-cli
- How to add php to theme to show alt attributes
- Why won’t these imported images show up?
- Remove rel=”attachment wp-att-XX”
- Using Taxonomy Image code with my get_categories code
- Generate image size, based on the image-orientation
- Rename image during upload using date and time stamp?
- How to Add extra option to Image Block Settings?
- Upload thousands of images to WordPress without plugin?
- Images in the Twenty Fourteen theme
- Get author ID with attachment ID
- Automatically replace original uploaded image with large image size
- Problem with loading images from child theme CSS file with relevant path
- Bulk edit Gutenberg single images to change from linking to media file to attachment page
- Generating different dimension images while uploading image file from custom plugin page
- is it possible to crop cover images in buddypress?
- Any specific reason why images do not show on site?
- Disallow img tag in comments?
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- Image upload appearing as broken images following server move
- In Wordress one author can not see the other’s author uploaded images through media library
- Regex expression for redirecting image URLs to another folder
- Why are images created by WP larger than the original uploaded image?
- Scaling images for mobile
- How do I fix “Sorry, this file type is not permitted for security reasons”
- Add suffix to uploaded images
- Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1
- How to make thumbnails of uploaded animated gifs NOT animated
- Frontend Image Upload
- Multiple variables through wp_get_image_editor
- Removing featured image from gallery?
- How to add image in rss?
- Rewrite inline image markup
- URL through custom field returning null
- How to set a Background image in WordPress?
- Images don’t load erratically
- Weird encoded error when using wp_generate_attachment_metadata()
- big trouble with javascript
- I want to rel=nofollow wordpress images
- Local install not loading template images but is loading everything else XAMPP
- Display cropped thumbnail not featured image
- Hide image gallery in Woocommerce if NO image [closed]
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- How to get the cropped image from media library?
- wordpress makes duplicate images of different size
- Add a span tag around image
- fitting the thumbnail image into a div
- Attachments without images
- Responsive Images from S3 has no srcset
- How to only show div of caption if caption exists on featured image
- How to “lazy load” post thumbnail
- Editing already up-loaded images
- Landing Page with HTML CSS JS and Images on wordpress
- Change Image URL on upload to some random number automatically
- wp_insert_attachment() dupplicate attachment posts
- Image title replace with current date
- WordPress Responsive Image ( srcset ) not work properly
- Product Gallery Images to go into full size on Product Page
- Change Image in Mobile Search Results
- Why does wp_get_attachment_image_src return the wrong size, when the correct size exists?
- add_image_size limiting sizes (???)
- WooCommerce Variation Swatches and Photos – get attribute thumbnail
- Are WP images responsive by default?
- Prevent WordPress from creating individual size images
- wordpress images not showing properly
- Keep the original ratio in a thumbnail image
- What is the best way to handle Ajax image upload on front end?
- How can I set different banner images using background cover at different breakpoints?
- variable crop option with add_image_size()
- Why doesn’t WordPress make thumbnails for videos?
- Plain image uploading – no links, no classes, no sizes
- Thumbnail gallery by date and taxonomy
- Images with excerpt function
- How do I get resized thumbnails?
- How do I embed an image at actual size?
- Display ajax preloader for large images within posts
- Uploading Full Size Image vs Resizing Before Upload
- Insert image doesn’t pickup right size
- Storing images on a local site
- Images will not attach to posts after site migration
- Tried everything but Facebook share button won’t load the post thumbnail
- Set image dimension for WP_Customize_Image_Control images
- Stop underlining image links
- How to hide image alt text/caption in Visual Composer?
- How to get attached image alt text in media.php?
- Why some images are not allowed to be edited only for thumbnails?
- problems with alt text not appearing in source code
- Delete all thumbnails & regenerate them?
- Can I turn an image into a button?
- Why are some SVG-images not visible in my footer?
- Gutenberg block HTML image rendering override
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions