问题描述
我创建了一个显示员工的简码,HTML看起来像这样:
I created a shortcode which display the employees, the HTML look somthing like that:
<ul class="employees">
<li><img src=""> <h5>name</h5> <p>description</p></li>
<li><img src=""> <h5>name</h5> <p>description</p></li>
..
</ul>
所以我创建了2个简码:
So I created 2 shortcodes:
[start_employee]-包含<ul class="employee"> .. </ul>
[start_employee] - which contains <ul class="employee"> .. </ul>
[员工]-包含有关员工的内容
[employee] - which contains content about the employee
它应该像这样工作:
[start_employee]
[employee img=".." name=".." description=".."]
[employee img=".." name=".." description=".."]
[/start_employee]
但是当我将其放在wordpress编辑器中时,html看起来像这样:
but when I put it in the wordpress editor the html look like that:
<ul class="employee">
[employee img=".." name=".." description=".."]
[employee img=".." name=".." description=".."]
</ul>
我想我知道为什么..因为start_employee的功能包含:
I think I know why.. because the fuunction of start_employee contain:
return '<ul class="employee">'.$content.'</ul>';
将其读为简码应该怎么办?
What should I do that it read it as a shortcode?
谢谢.
推荐答案
短代码不会自动嵌套-您必须自己调用do_shortcode($content)
.请参见 http://codex.wordpress.org/Shortcode_API 上的caption_shortcode()
示例.
Shortcodes do not automatically nest -- you have to call do_shortcode($content)
yourself. See the caption_shortcode()
example on http://codex.wordpress.org/Shortcode_API.
这篇关于简码内的简码-Wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!