do_shortcode() problem (or bug)
-
This is my shortcode:
function add_div($atts, $content = null) { $class = shortcode_atts( array('class' => 'default_class'), $atts ); return '<div class="'.$class['class'].'">'.$content.'</div>'; } add_shortcode("add_div", "add_div");I’m trying to use this on page template:
<? echo do_shortcode('[add_div class="some_class"]Some text[/add_div]'); ?>And it return something like that:
<div class="some_class"></div> CONTENT GOES HEREI want it to make it like this:
<div class="some_class">CONTENT GOES HERE</div>The problem is that it doesn’t parse [/add_div] element.
It makes it correct (it parses [/add_div]) when my shortcode is placed on some page or in post but it doesn’t work in template file.
Please help!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘do_shortcode() problem (or bug)’ is closed to new replies.