wp plugin -17

var_dump( $shortcode_tags );

 

remove_shortcode()

 

remove_all_shortcodes()

 

strip_shortcodes()

< ?php

$content = < < < S

Some existing shortcodes: [amazonimage] [gallery]

These don’t exist: [bleh] [123]

S;

echo strip_shortcodes( $content );

/* Result:

Some existing shortcodes:

These don’t exist: [bleh] [123]

*/

? >

 

shortcode_atts()

 

do_shortcode(). 

Recursive Shortcodes,[b]some [i]text[/i] here[/b]

< ?php

// add shortcodes [b] and [i]

add_shortcode( ‘i’, ‘boj_sc5_italic’ );

add_shortcode( ‘b’, ‘boj_sc5_bold’ );

// callback function: return bold text

function boj_sc5_bold( $attr, $content ) {

return ‘ < strong > ’ . do_shortcode( $content ) . ‘ < /strong > ’;

}

// callback function: return italic text

function boj_sc5_italic( $attr, $content ) {

return ‘ < em > ’ . do_shortcode( $content ) . ‘ < /em > ’;

}

? >

 

posted on 2012-12-04 19:55  kalintw  阅读(114)  评论(0)    收藏  举报

导航