agis
agis

Reputation: 1841

add php shortcode in return function

I have this part of code:

return '<img class="myimage '.$text_color.' '.$horizontal.$slide_fitscreen.'" src="'.$image.'" alt="" '.$slide_desc.' />';

What I want to do is to return also a php shortcode but not inside the <img>, because my shortcode generates a <a> element so I need to return it after the img

this is my shortcode:

<?php echo do_shortcode('[gallery]'); ?>

How can I make this ?

Thanks!

Upvotes: 1

Views: 362

Answers (1)

Ayman Safadi
Ayman Safadi

Reputation: 11552

Do you mean something like:

return '<img class="myimage '.$text_color.' '.$horizontal.$slide_fitscreen.'" src="'.$image.'" alt="" '.$slide_desc.' />'.do_shortcode('[gallery]');

Upvotes: 1

Related Questions