简体   繁体   English

WordPress主题中的联系页面

[英]contact page in wordpress theme

Now iam working in wordpress to modify new template.now i need to do contact page in that theme for this i have tried this link wordpress 现在我在wordpress中工作以修改新template.now我需要为此主题做联系页面,我已经尝试了这个链接wordpress

my doubt is where i need to put this coding, 我的疑问是我需要在哪里进行编码,

<?php get_header(); ?>

  <?php while ( have_posts() ) : the_post(); ?>

      <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <header class="entry-header">
          <h1 class="entry-title"><?php the_title(); ?></h1>
        </header>

        <div class="entry-content">
          <?php the_content(); ?>

          <p>FORM CODE GOES HERE</p>

        </div><!-- .entry-content -->

      </article><!-- #post -->

  <?php endwhile; // end of the loop. ?>

</div><!-- #content -->

This code has nothing to do with a contact form this i just a basic page template code. 此代码与联系表单无关,这只是基本的页面模板代码。

They are showing how to create a custom form but you won't need it just use Contact Form 7 or you can search for many options available in the plugin directory. 他们展示了如何创建自定义表单,但您不需要仅使用Contact Form 7 ,也可以在插件目录中搜索许多可用选项。

Create a form and just use the shortcode that it generates on your contact us page and you won't need to use the code above. 创建一个表单,只需使用它在“与我们联系”页面上生成的简码,您就不需要使用上面的代码。

If you are using Contact Form 7, you would put the code into a template like this (after you've already set it up in your WP Admin): 如果您使用的是联系表格7,则可以将代码放入这样的模板中(在WP Admin中已经设置好之后):

  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <header class="entry-header">
      <h1 class="entry-title"><?php the_title(); ?></h1>
    </header>

    <div class="entry-content">
      <?php the_content(); ?>

      <p><?php echo do_shortcode( '[contact-form-7 id="1234" title="Contact form 1"]' ); ?></p>

    </div><!-- .entry-content -->

  </article><!-- #post -->

via: http://contactform7.com/faq/can-i-embed-a-contact-form-into-my-template-file/ 通过: http : //contactform7.com/faq/can-i-embed-a-contact-form-into-my-template-file/

It is not a good idea to include custom code to your WordPress theme, because you'll lose the opportunity to get updates to the theme with new WordPress releases. 将自定义代码包括在WordPress主题中不是一个好主意,因为您将失去使用新WordPress版本获得对该主题进行更新的机会。 I recommend you to use plugins, there are many of amazing Contact Form plugins are out there, like WordPress Contact Form Slider 我建议您使用插件,那里有许多令人惊叹的Contact Form插件,例如WordPress Contact Form Slider

In this case you don't need to code anything, just configure the plugin and/or use a simple shortcode to include it to a specified page. 在这种情况下,您无需编写任何代码,只需配置插件和/或使用简单的短代码即可将其包含在指定页面中。

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

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