Forcing WP to embedd a video when using a shortcode

There may be a more graceful way to do this, but it works: function shortcode_youtube($atts) { extract(shortcode_atts(array( “id” => ”, “align” => ‘aligncenter’ ), $atts)); global $wp_embed; $content=”‘; $embed = $wp_embed->run_shortcode( $content ); return ‘<div class=”‘.$align.'”>’ . $embed . ‘</div>’; } add_shortcode(“youtube”, “shortcode_youtube”);

Custom shortcode breaks my page

Is the $my_id variable supposed to come from an attribute on the shortcode? E.g. [chapter my_id=”123″]Lorum ipsum…[/chapter] If so, at the beginning of your chapters() function, you need to retrieve the attributes out of the array being passed in. Something like: extract( shortcode_atts( array( ‘foo’ => ‘something’, ‘bar’ => ‘something else’, ), $atts ) ); … Read more

Shortcode interpreted as text

This is invalid syntax. See shortcodes like HTML: Opening delimiter [, name intern, empty space, attribute name, equal sign =, attribute value (enclosed with quotes (‘ or “), closing delimiter ]. Doubled delimiters force the shortcode to be shown as it is, the shortcode handler will not be used. [[Intern: Termine/News]] is wrong, you need … Read more

Pass data back to TinyMCE from Thickbox

Okay so I spit through some existing themes I have to try and figure out how to achieve this. If anyone is reading this, this is how I did it: In the onclick function of the TinyMCE I called the ajax form and then inside the form I added some javascript that uses the tinyMCE.activeEditor.execCommand(‘mceInsertContent’, … Read more

Theme doesn’t support shortcodes

Your theme has to be removing the shortcodes. Look for remove_shortcode in the theme’s files, probably functions.php. Or remove_all_shortcodes. Or it has to be removing do_shortcodes from the the_content hook. Look for remove_filter(‘the_content’,’do_shortcode’,10). If that doesn’t do it, the theme is probably doing something odd with the post content– like bypassing the normal WordPress functions. … Read more

Youtube shortcode

Few remarks about your code: 1) First you should use something like: https://www.youtube.com/v/EhWopzlRwZ8 instead of the YouTube page: https://www.youtube.com/watch?v=EhWopzlRwZ8 in your embed code. 2) You can always use the 3) You should consider adding a prefix to your shortcode callback, for example macko_tarana_ to avoid function name collision with other plugins. 4) Try to avoid … Read more