stray elements

Remove the filter from the the_content and run it after the shortcode are processed. Try: remove_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘wpautop’ , 12); Usually shortcodes are processed after wpautop is applied to the content. See http://core.trac.wordpress.org/browser/tags/3.1/wp-includes/shortcodes.php#L296

Why do_shortcode is not executing the shortcode in data-* html attributes?

do_shortcodes_in_html_tags() runs attributes through wp_kses_one_attr() which checks them against wp_kses_allowed_html( ‘post’ ) which by default only accepts standard non-data attributes, so you’d have to add your attribute: add_filter( ‘wp_kses_allowed_html’, function ( $allowedposttags, $context ) { if ( $context == ‘post’ ) { $allowedposttags[‘a’][‘data-abc’] = 1; } return $allowedposttags; }, 10, 2 );

How do I create shortcodes for my wordpress themes?

See the Shortcode API article on the Codex for a tutorial and my Shortcode Plugin for some examples. A very basic example for the functions.php: /** * Shortcode for bloginfo() * * Usage: [bloginfo key=”template_url”] * * @see http://codex.wordpress.org/Template_Tags/get_bloginfo * @source http://blue-anvil.com/archives/8-fun-useful-shortcode-functions-for-wordpress * @param array $atts * @return string */ function bloginfo_shortcode($atts) { extract( shortcode_atts( … Read more

How to pass multiple values in shortcode?

You can create your own shortcode which will hold all of that for you hardcoded: add_shortcode(“my_five_forms”,”my_five_forms_handler”); function my_five_forms_handler($atts,$content =null){ $con = “[frm-entry-delete-link id=9 page_id=25 field_key=hsn108] [frm-entry-delete-link id=12 page_id=25 field_key=cp7pi] [frm-entry-delete-link id=13 page_id=25 field_key=ksa9qv] [frm-entry-delete-link id=14 page_id=25 field_key=9zuf6o] [frm-entry-delete-link id=15 page_id=25 field_key=w8w7op]”; return do_shortcode($con); } // and use it like this: [my_five_forms] or create a shortcode … Read more

how to create shortcode in wordpress

You can create your short code just few steps. function short_codeFunction_name( $atts, $content=null ) { shortcode_atts( array(), $atts); $rowin = ‘<div class=”row”>’.do_shortcode( $content ) .'</div>’; return $rowin; } add_shortcode( “your_shortcode_name”, “short_codeFunction_name” ); Then you can access [your_shortcode]Here your content[your_shortcode] format inside the Post,page etc. add this function inside function.php in active theme directory. use inside … Read more

Using shortcodes in PHP

Referering to the Shortcodes API you can do echo do_shortcode(‘[helloworld]’); if your shortcode not in post. Or you can do echo apply_filters(‘the_content’, ‘[helloworld]’); but this will also bring other filters to work on your shorcode return html.

How to render complicated shortcodes

Good to hear that you managed to solve the problem already. Here’s a few examples on how you could also return html from a shortcode. As you already found out, you can use ob_start() and ob_get_clean() to buffer the html. Inside it you can echo the markup or drop out of PHP and write plain … Read more