I've use the following code for an enclosing shortcode and it works perfectly in the posts.
function date_code($attr, $content)
{
return '<h3>' . $content . '</h3>';
}
add_shortcode('datecode', 'date_code');
But when I try to use it in a page template using http://codex.wordpress.org/Function_Reference/do_shortcode it's not working.
I've use the following code in my template:
echo do_shortcode( '[datecode]' . $content . '[/datecode]' );
Please help me since the non-enclosing shortcode works fine with do_shortcode. And, I'm ignorant with regards to using enclosing shortcode in a page template.
I want to display the shortcode in the page template like in the posts. Thanks in advance.
$content
when you usedo_shortcode
?$content
defined in your template? how does 'it is not working' show?