Reputation: 25
I am trying to add a function within string to show the output of function via shortcode but it is showing error.
function foo_shortcode($atts, $content = null) {
$datashortcode = '<div>'
.if(function_exists('rtb_kk'))
{
rtb_kk();
}.
'</div>'
;
return $datashortcode;
}
add_shortcode('showfoo', 'foo_shortcode');
Where i am making mistake?
Upvotes: 0
Views: 57
Reputation: 18557
You have syntax error,
$datashortcode = '<div>'.(function_exists('rtb_kk') ? rtb_kk() : '').'</div>';
Replace this line.
Upvotes: 2