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?
- Custom theme hooks / filters – passing arguments
- How to hook wp_list_pages?
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- Add filter to wp_dropdown_pages() or wp_dropdown_categories() – no select container?
- Pass parameter to the upload_dir filter
- Filter or Hook to catch pre-rendering of post content
- check to see if hook is available
- How to allow users to view pending posts of a specific custom post type?
- Remove filter callback: method in class
- Add content as soon starts
- How to get a single hook from wp_head()?
- WP filter to alter admin CSS styles?
- How to get the post excerpt using post object?
- Filter Media by attached page or blog post in Library
- How to stop DOMDocument destroying embeds?
- WordPress add_filter to post_date
- Put data in my-account/view-order/id/ page
- Only show read more text when when wp:post-excerpt meets excerptLength
- posts_results filter – additional sort, with a meta value, to move posts to the end of the results, with pagination working
- How to use parse_query() to add an additional filter based on content to page search?
- FacetWP was unable to auto-detect the post listing : Having an issue with ACF load choices causing FacetWP error