I have a variable inside my php-file which includes HTML like this:
$content = '<div id="wrapper"><div>Lorem Ipsum</div></div>'
return $content;
which returns in HTML:
<div id="wrapper">
<div>Lorem Ipsum</div>
</div>
But I want to add something here:
<div id="wrapper">
{HERE} <-----
<div>Lorem Ipsum</div>
</div>
What I want to add is not HTML yet because its a WordPress shortcode like this:
[image_hover target="_self" image="23162" link="/"]
which can be parsed with PHP echo or the do_schortcode() function in WordPress.
How can I put this together inside that HTML string?
$content = '<div id="wrapper">' . do_shortcode('[image_hover target="_self" image="23162" link="/"]') . '<div>Lorem Ipsum</div></div>'
because this combination is not working.
The do_schortcode() function has to be stored in a variable before
$shortcode = do_shortcode('[image_hover target="_self" image="23162" link="/"]');
$content = '<div id="wrapper">' . $shortcode . '<div>Lorem Ipsum</div></div>';
return $content;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.