Register a new shortcode handler depending on the attribute value:
function wrapper_shortcode_handler ( $atts, $content ) {
if ( "apple" === $atts["snack"] )
add_shortcode( "flavor", "healthy_callback" );
if ( "donut" === $atts["snack"] )
add_shortcode( "flavor", "fatty_callback" );
return do_shortcode( $content );
}
Related Posts:
- 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
- How to add attribute to output with wp_video_shortcode add_filter
- 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
- Format content value from DB outside of WordPress filters
- Use content custom filter for all shortcodes
- How to link current user to their author page through shortcodes
- filter title from shortcode
- how to remove filter from wordpress shortcode output
- Error when overriding only some audio shortcode HTML output
- How to use shortcode attribute in separate function
- Shortcodes — Using add_action, add_filter in the shortcode
- How to pass variables to custom filter from multiple functions
- How to filter backend post list showing only posts having a shortcode
- How can I return shortcode output to the top of the content?
- the_excerpt filter doesn’t work as expected
- Conditional does not work with add_filter
- run shortcode in excerpt of single custom post type
- Filter everything from content except output of a shortcode
- Something is filtering my shortcodes… Can’t figure out what
- 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
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- Shortcode / plugin with custom (flexible) output
- Filter Shortcodes when using get_page
- 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
- Override wordpress audio playlist
- 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?
- Add filter conditionally to a page
- Auto-generated excerpt with shortcode and read more button/text link
- shortcode function outputs multiple anchor tags
- apply_filters to $GLOBALS
- Change shortcode output (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
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- What do add_filters() and apply_filter() do?
- What to use instead of the content_save_pre filter?
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Can’t change a label in woocommerce with the normal filter
- WordPress RSS feed – filter RSS content by custom field value
- Adding body class when post contains a specific shortcode
- Add classname to the_category() function?
- Filter the URL of next_posts_link & previous_posts_link
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- Gutenberg disable the “block” tab in right sidebar
- Editing
- the_content filter – checking the post
- add_filter to apply_filters that exists within class
- Adding a title prefix with the the_title filter
- How to removes all instances of thumbnails displayed in my theme?
- How to modify an existing meta description?
- Adding TinyMCE buttons without removing plugin buttons?
- Can the wordpress color palettes by changed through Javascript?
- Filter on the_content doesn’t update the content being searched via register_rest_route
- Where to add_filter in theme functions.php?
- tag removed not using a filter
- What hooks to hook onto for automatic cache clearing
- Add filter to get_posts
- Adding a template part as part of a shortcode
- How can I output all apply_filters and do_action?
- Override has_post_thumbnail function
- remove_action: how to access to a method in an child class?
- Set default value for “Additional CSS class(es)” for specific block types
- Woocomemrce order and registration fileds to UPPERCASE
- How to add nonce tag to inline script for CSP
- Filter content for get_the_content()
- How to strip out javascript in wp_posts `post_content`
- add after content don’t work
- Customizing the wp_video_shortcode output with add_filter
- I want to add string array to this function to filter displayed option in drpodown [closed]
- How to filter reading/visibility posts based on role?
- Filter and validate user role in registration
- Unable to get WordPress’s apply_filters(‘site_url’) to return a https scheme
- String Replace Caching & Chance of Collisions
- is_page_template() doesn’t work with excerpt_length filter
- What is the scope and persistence of add_filter() and remove_filter()?
- GET form action. Redirect to self
- if i put the code in my theme’s function.php file can it work?
- Admin New Order: Autofocus on Search a product