[Plugin: Mini Loops] Adding Shortcodes ?
-
I’m trying to add some new shortcodes but it’s not interpreted.
In fact, I’m using KIA Subtitle which add a subtitle field (just under the title and that’s better for my user than a custom field) and is accessible with the_subtitle or get_the_subtitle functions.
I know I could achieve that with custom fields… but I’m curious to know why my try failed. Here is the code I add to helpers.php :add_shortcode( 'ml_subtitle' , 'miniloop_subtitle' ); function miniloop_subtitle( $atts ) { extract( shortcode_atts( array( 'length' => 0, //characters 'before' => '', 'after' => '', ), $atts ) ); $subtitle = apply_filters( 'the_subtitle', get_the_subtitle() ); if ($length) $subtitle = substr( $subtitle, 0, $length ); $subtitle = $before . $subtitle . $after; return $subtitle; }
Thanks for your help !
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[Plugin: Mini Loops] Adding Shortcodes ?’ is closed to new replies.