You just forgot to return
the excerpt for the other post types.
Try for example:
function do_my_shortcode_in_excerpt( $excerpt )
{
if ( 'services' == get_post_type() )
$excerpt = do_shortcode( wp_trim_words( get_the_content(), 55 ) );
return $excerpt;
}
add_filter( 'get_the_excerpt', 'do_my_shortcode_in_excerpt' );
Related Posts:
- the_excerpt filter doesn’t work as expected
- Auto-generated excerpt with shortcode and read more button/text link
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How to get shortcode’s input values inside a filter?
- Filter specific shortcode output?
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter and changing output captions of image gallery
- Get excerpt from $post->post_content
- How to use the_excerpt in a filter hook?
- How to add attribute to output with wp_video_shortcode add_filter
- add_filter on “the_excerpt” only works when post does not have excerpt
- Search content for shortcodes and get parameters
- Change default settings used by gallery shortcode
- Shortcodes not resolved in AJAX call response
- Ajax, filters and shortcodes
- End excerpt at the end of the sentence
- Format content value from DB outside of WordPress filters
- Use content custom filter for all shortcodes
- get_the_excerpt() with fallback like the_excerpt()
- How to link current user to their author page through shortcodes
- filter title from shortcode
- how to remove filter from wordpress shortcode output
- How do I filter get_the_excerpt() but keep all of its functionality intact?
- Error when overriding only some audio shortcode HTML output
- How to use shortcode attribute in separate function
- Buddypress: Edit activity when new blog post [closed]
- Why in archive page doesn´t show read more button with excerpt?
- the_excerpt filter with an empty excerpt
- Shortcodes — Using add_action, add_filter in the shortcode
- Access get_the_title() from ‘excerpt_length’ filter
- How to pass variables to custom filter from multiple functions
- How to filter backend post list showing only posts having a shortcode
- Give “Read More” precedence over excerpt() word count
- How do I override the_excerpt so that it will display full content?
- How can I return shortcode output to the top of the content?
- Excerpt is being added above the content, but it should be after it
- apply_filters(‘get_the_content’, $content) + Except
- Filter everything from content except output of a shortcode
- Something is filtering my shortcodes… Can’t figure out what
- Trimming a custom field to a length
- How to use do_shortcode_tag to modify the output of a shortcode?
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- WordPress removing slashes from shortcode output
- Adding html banner to posts
- Apply wordpress filter checking category
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- Add Filter – Pass Variable (PHP < 5.3)
- Shortcode / plugin with custom (flexible) output
- Filter Shortcodes when using get_page
- Parse a shortcode differently based on on what it’s nested in
- Need to return shortcode text instead of the output
- add_filter to the_content after apply_filters
- post_orderby filter breaks function
- the_content getting current page content instead specified ID
- Filter Post Title without affecting screen-reader-text
- Override wordpress audio playlist
- Create different flavours of excerpt
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- Add Index to Item in WordPress Gallery
- create a shortcode with acf including a filter
- How to take shortcode and content separately from a page?
- Cutting off excerpt with first sentence
- Hide disclaimer from summary excerpts
- Read More in the actual excerpt
- shortcode function outputs multiple anchor tags
- apply_filters to $GLOBALS
- Change shortcode output (filter?)
- is_page_template() doesn’t work with excerpt_length filter
- Is it possible to include the add_filter() function within a shortcode function
- Activate short codes for all post queries?
- Problem with shortcodes in external file
- the_excerpt() does not work with has_excerpt()?
- get_the_excerpt on mobile still displays continue reading
- Custom excerpt_more filter not working when tag is present
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- Why does using excerpt_more filter change link location?
- current_shortcode() – detect currently used shortcode
- Change email from and display name with a filter action
- WordPress tag cloud add more links
- How to center oEmbedded content
- Add Sortable Column For All Post Types
- How to remove medium size class in gravity form for input tag?
- Custom wp_query time filter on meta_value
- Modify page title and subtitle with a plugin
- output custom Posts on a Page
- WordPress Gutenberg core/heading block (wp-block-heading)
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Remove figcation from excerpt
- Modify oembed code conditionally
- Modify Default URL for /wp-includes/js/wp-emoji.js?ver=4.6.1
- wp_editor customization
- posts_results filter function memory errors
- Loading a sidebar on an Ajax call
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- How do you disable the verification process of user email changes?
- Filter a custom post type by custom field in admin