将短代码放在php模板文件中

时间:2016-10-25 06:54:56

标签: php wordpress function shortcode codex

之前已经讨论过这个问题,但它对我不起作用。由于短代码似乎是常规和开放式短代码的混合。或嵌套短代码的组合。

// Use shortcode in a PHP file (outside the post editor).
echo do_shortcode( '' );

// In case there is opening and closing shortcode.
echo do_shortcode( '[iscorrect]' . $text_to_be_wrapped_in_shortcode . '[/iscorrect]' );

这是我想在我的php模板中显示的短代码

[mk_page_section bg_stretch="true" full_width="true" padding_top="0" padding_bottom="0" sidebar="sidebar-1"][vc_column][mk_header hover_styles="5" logo="false"][/vc_column][/mk_page_section]

我想要实现的是在不使用我的主题页眉或页脚的网络研讨会页面上显示我的主导航。

是否可以像这样使用它?

<?php echo do_shortcode('[mk_page_section bg_stretch="true" full_width="true" padding_top="0" padding_bottom="0" sidebar="sidebar-1"][vc_column][mk_header hover_styles="5" logo="false"][/vc_column][/mk_page_section]'); ?>

或者它必须是组合吗?完全失去了......

为什么do_shortcode不起作用?

0 个答案:

没有答案
相关问题