在返回函数中添加php短代码

在返回函数中添加php短代码

问题描述:

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!

我有这部分代码: p>

  return'&lt  ; img class =“myimage”。$ text_color。'  '。$ horizo​​ntal。$ slide_fitscreen。'“src =”'。$ image。'“alt =”“'。$ slide_desc。'  /&gt;'; 
  code>  pre> 
 
 

我想要做的是返回一个php短代码但不在&lt; img&gt; code>中, 因为我的短代码会生成一个&lt; a&gt; code>元素,所以我需要在 img strong> p>

后返回它,这是我的短代码:

 &lt;?php echo do_shortcode('[gallery]');  ?&gt; 
  code>  pre> 
 
 

我该怎么做? p>

谢谢! p> div>

Do you mean something like:

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