What is the best way to enable nested shortcodes?
http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes Everything you need to know about nested shortcodes in WP
http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes Everything you need to know about nested shortcodes in WP
Sorry, brackets are still not allowed within shortcodes, as you can see in the Shortcode API. However it’s possible to use enclosing shortcodes which will allow to use brackets. Let me demonstrate this: Shortcode: [foo bar=”No brackets here!”]…use [brackets] here[/foo] You can add this kind of shortcode in your functions.php like this: add_shortcode( ‘foo’, ‘foo_shortcode’ … Read more
Unfortunately, this is going to be a problem for you. The [ted] shortcode is specific to WordPress.com – not to a self-hosted site where you installed the software yourself from WordPress.org. The only embeds that WordPress.org’s software supports by default are listed in the Codex: YouTube (only public videos and playlists – “unlisted” and “private” … Read more
You’re asking about X, but I’ll answer with Y. IMHO, there are too many exceptions to handle to grant another solution. SyntaxHighlighter Evolved has the following Pro Tip (strong, uppercase, in the original): TIP: Don’t use the Visual editor if you don’t want your code mangled. TinyMCE will “clean up” your HTML. Not only that, … Read more
The easiest way would be to replace $content = $toc . $content; with $content = str_replace( ‘[toc]’, $toc, $content ); This would do a search for the string [toc] and replace it with the table of contents. It might be more complicated due to how the plugin would work, but on paper it is simple.
The reason why this is happening, seems to be found in the file wp-includes/class-wp-embed.php in the autoembed call-back method: /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} for potential embedding. * * @uses WP_Embed::autoembed_callback() * * @param string $content The content to be searched. * @return string Potentially … Read more
Ok found a solution function product_gallery_shortcode($atts) { extract(shortcode_atts(array( ‘product_id’ => ’31’, ‘prodvid’ => false, ‘youtubeids’=> ”, ‘thumbnr’ =>2 ), $atts)); etc and i had to turn youtubeids into an array again $youtubeidsnew = array(); $youtubeidsnew = explode(‘,’, $youtubeids);
There is a clue in wp-includes/formatting.php in the function wptexturize: $default_no_texturize_shortcodes = array(‘code’); … $no_texturize_shortcodes=”(” . implode(‘|’, apply_filters(‘no_texturize_shortcodes’, $default_no_texturize_shortcodes) ) . ‘)’; Try using this filter to add a shortcode to the array: function my_no_tex( $shortcodes ) { $shortcodes[] = ‘someshortcode’; return $shortcodes; } add_filter( ‘no_texturize_shortcodes’, ‘my_no_tex’ );
You need to get the attributes of the shortcode, which is quite simple and documented in the add_shortcode() examples: function wrapthecode( $attr ) { if( empty( $attr[‘id’] ) ) return ‘No ID given.’; return do_shortcode(‘[contact-form-7 id=”‘ . $attr[‘id’] . ‘”]’); } add_shortcode( ‘myform’, ‘wrapthecode’ );
A shortcode has to return just a string, you should not print something like in wp_list_pages() or echo. From Shortcode API: The return value of a shortcode handler function is inserted into the post content output in place of the shortcode macro. Remember to use return and not echo – anything that is echoed will … Read more