如何在模板中调用WordPress短代码? [英] How can I call a WordPress shortcode within a template?
本文介绍了如何在模板中调用WordPress短代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个 与我们联系表格 .
There's a plugin for the Contact us form.
要激活表单,只需将[CONTACT-US-FORM]
放置在页面中...
To activate the form, all you have to do is to place [CONTACT-US-FORM]
in the page...
我的页面正在调用页面模板. 可以在PHP模板中添加[CONTACT-US-FORM]短代码吗?
My page is calling a page template. Is it possible to add the [CONTACT-US-FORM] shortcode in the PHP template?
我尝试过,但是没有用.
I tried it and it did not work.
WordPress页面有效,但不是我想要的方法.
The WordPress page worked, but not the method I want.
[CONTACT-US-FORM]
PHP与我们联系模板,我想尝试类似的方法,但是没有用.
PHP Contact Us template I want to try something like this, but it did not work.
<?php
/*
Template Name: [contact us]
*/
get_header(); ?>
[CONTACT-US-FORM]
<?php get_footer(); ?>
推荐答案
echo do_shortcode('[CONTACT-US-FORM]');
在模板中使用它.
更多信息,请点击此处: 执行短代码
Look here for more: Do Shortcode
这篇关于如何在模板中调用WordPress短代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文