If you did not set an explicit excerpt for your post in the post editor, WordPress by default calls wp_trim_excerpt()
to auto-generate an excerpt. This function throws out all HTML tags to make life simple. the_content()
does not do this when it splits your post on a <!--more-->
tag.
If you don’t want this default behavior you can unhook the wp_trim_excerpt()
function and duplicate it with one of your own that does not remove HTML tags. Watch out when you split your text somewhere: call force_balance_tags()
to make sure your excerpt does not end with Some <strong>great news... [Read more]
, because everything after it will be bold too. You will also have to see how this works with embedded content: if you remove some of the tags for a Flash video you also won’t get what you expect.
Related Posts:
- Extract image from content and set it as the featured image
- Check if the user has explicitly set an excerpt
- How to override function in functions.php of parent theme?
- Show Video in Excerpt
- When is wp_trim_excerpt() called?
- Stripping shortcode from custom excerpt function
- Edit the_content function
- Remove images from get_the_excerpt
- Custom page template how to check is_page from functions.php?
- Remove image from post_content on save_post
- display public excerpt for private post
- Make WordPress size and name images for Retina.js
- get_the_excerpt() not returning anything when post has no excerpt
- get excerpt without images
- WordPress function/template tag to get first n words of the content
- Pinterest Integration Using functions.php
- Allow latex in wordpress excerpt
- Allowing SVG uploads in media uploader without plug-in
- Custom excerpt legnths for specific pages
- Unable to get_the_content(); of a post in WordPress via AJAX
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Using “Read More” link with custom excerpt
- How to display post content instead of excerpt
- Automatically wrap multiple images in div
- How can I add text to all posts/pages/categories/homepage etc
- Using Schema with `the_excerpt`
- Display post shortcode content in the sidebar?
- Error when adding excerpt to the content through functions.php
- Custom Post excerpt not working correctly
- Limit length of first excerpt in the loop
- new_excerpt_more link not working properly
- Excerpts are not displayed by a shortcode on category pages
- How to display retweet count and likes in the meta above the excerpt
- Setting a default text for excerpts of a particular category
- Remove links from the_content when using filters wp_trim_excerpt
- If user is logged-in display/hide something
- Excerpt for pages not showing
- The_excerpt() doesn’t parse – how to change that?
- Tags break custom Excerpt function
- How do I pull excerpts from pages?
- WordPress Excerpt – How to remove the first link using functions.php
- Strip div From Excerpt
- How to change value of variable in theme file with functions.php WordPress?
- first paragraph of the_content as meta description
- Adding Read More to Custom excerpts
- Limit number of characters in different excerpts
- Appending „read more” to the excerpt conditionally
- Hide disclaimer from summary excerpts
- What is best practices to move the following code into a function?
- How to make an If Else on Excerpt Filter
- Regex works in regexr, but not if I filter content [closed]
- getExcerpt: Make ellipsis appear only if character limit is reached
- Problem in outputting shortcode
- need help with ‘… read more’ excerpt in functions.php
- Problem in shortcode outputting content
- Excerpt length: get 2 paragraphs
- Check if excerpt is empty at loop-portfolio
- Can’t change excerpt length and more tag
- More link – not text
- How to add an excerpt and read more link to a page?
- Adding a filter to my posts
- Excerpt – First Sentence & Read More
- Integrating custom API for post content into Admin interface & Public Website [closed]
- Trying to get this function to show below the content
- function to show youtube videos within excerpt – if condition and apply_filters
- How to change the markup WordPress inserts for post images
- When tax_query used, results disappear (0 =1 produced)
- wp_get_attachment_image returns different image size
- Limit the length of the Author Profile Biographical Text
- Logging in redirects to correct page but shows logged out content until forced refresh
- What is the criteria for pluggable functions?
- How can I stop a function from encoding an entity?
- Theme-Config tab in admin Pannel?
- Function to “Press Update Button” on all posts
- Change WP attachment name to postid during upload only for post type
- How to target only the front page (not subsequent paginated pages) in theme/plugin?
- Get the 5 lastest Featured Posts from a category
- Is it possible to change any of the HTML/URL returned from the_category()
- Activate small php condition at footer over page template
- How to insert custom widget in custom sidebar in theme activation?
- 404 redirect to previous category
- Want to dequeue all the CSS and JS from /wp-content/uploads/xyz-folder
- Scripts not loading when using the wp_enqueue_scripts action
- Text with special class as excerpt (or exclude special class)
- add referrer to woo
- overwrite code snippet from parent to child theme
- If no author posts, echo out some text
- How to Display WooCommerce Product Price in WooCommerce Archive
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Its my first time trying to create a website , I got an error Please help
- Shortcode Initialization in a Custom Theme
- Load scripts into an AJAX div
- restrict uploaded image size and fixed image display size
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Function not receiving string from shortcode
- Restricted images only for logged user. (hidden url)
- Override parent theme function that is not hooked or in the functions.php file
- Syling Custom Fields echo’s from from functions.php
- Shortcodes not outputting in correct divs
- Help finishing script to export WP user data when form submitted