this is shortcode in template:
function shortcode_frame_left( $atts, $content = null)
{
return '<span class="frame alignleft">'. do_shortcode($content) . '</span>';
}
add_shortcode('frame_left', 'shortcode_frame_left');
this is how using in post content:
[frame_left] <a href="YOUR-URL"><img src="YOUR-URL" /></a> [/frame_left]
I am trying to use this shortcode in template file for displaying post thumbnails. What i try:
if (has_post_thumbnail()) {
apply_filters( 'the_content', "[frame_left]".the_post_thumbnail()."[/frame_left]");
}
and
if (has_post_thumbnail()) {
$thumbnail = '[frame_left]'. the_post_thumbnail() . '[/frame_left]';
echo do_shortcode("$thumbnail");
}
What am i doing wrong?
frame_left
, code examples useframe_right
. Can I assume you haveframe_right
shortcode defined in same way?