Shortcodes: Return different based on atts

All you need is some very simple IF logic. The $author variable is set to be empty here “author” => ” unless an author name is used in your shortcode. So now that you know the default value of $author you can use IF logic to check if it is empty or not. Two logic … Read more

Strip shortcode from excerpt [duplicate]

A simple search in codex and you can set this! Anyway you can do something like : function remove_shortcode_from_excerpt($content) { $content = strip_shortcodes( $content ); return $content;//always return $content } add_filter(‘the_excerpt’, ‘remove_shortcode_from_excerpt’);

WP_Editor Shortcode Issue

You can display shortcodes in WP editor by removing do_shortcode filter from the_content filter as shown in the following code but beware that it will also display shortcodes tags when you use the_content() function in the theme anywhere else in that case before the_content() function add do_shortcode filter again like this add_filter(‘the_content’, ‘do_shortcode’,15 ); function … Read more

How to add a nested shortcode into editor?

You can do it developing a TinyMCE plugin and load it using mce_external_plugins hook. The key is in the javascript file of the TinyMCE plugin which will be responsible to pass the nested shortcodes into the editor textarea. You can take a look to this article (about the middle they shows an example of how … Read more