简体   繁体   English

在自定义模板页面中插入Wordpress联系人表格7

[英]Insert a Wordpress contact form 7 in a custom template page

I've been trying to insert a WP contact form 7 in a custom 'blank' page template. 我一直在尝试在自定义“空白”页面模板中插入WP联系人表格7。

Actually what I'm trying to do is insert the WP CF7 functionality in a very basic, clean page (just a nice background, able to adjust font, images, ...) but I don't want the page the look like this blogpost from the WP theme.. 实际上,我想做的是将WP CF7功能插入一个非常基本,干净的页面(只是一个不错的背景,能够调整字体,图像等),但是我不希望页面看起来像这样WP主题的博客文章。

I've tried to upload a white page template with FTP, but when I try to embed to WPCF7 code in the new page with the blank template, nothing happens... 我尝试使用FTP上传白模板,但是当我尝试使用空白模板在新页面中嵌入WPCF7代码时,没有任何反应...

Anybody who can help me out? 有人可以帮助我吗?

Thanks a lot! 非常感谢!

White page template 白页模板

   <?php /* Template Name: Blank Page
*
* A blank custom page template.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
*/
?>


<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>

Write Your code Like this: 像这样编写您的代码:

<?php
/* Template Name: Blank Page
*
* A blank custom page template.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
*/

get_header();

$id= get_the_ID(); 
$post = get_post($id); 
$content = apply_filters('the_content', $post->post_content); 
echo $content; 

get_footer();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM