繁体   English   中英

WordPress主题中的联系页面

[英]contact page in wordpress theme

现在我在wordpress中工作以修改新template.now我需要为此主题做联系页面,我已经尝试了这个链接wordpress

我的疑问是我需要在哪里进行编码,

<?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 -->

此代码与联系表单无关,这只是基本的页面模板代码。

他们展示了如何创建自定义表单,但您不需要仅使用Contact Form 7 ,也可以在插件目录中搜索许多可用选项。

创建一个表单,只需使用它在“与我们联系”页面上生成的简码,您就不需要使用上面的代码。

如果您使用的是联系表格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 -->

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

将自定义代码包括在WordPress主题中不是一个好主意,因为您将失去使用新WordPress版本获得对该主题进行更新的机会。 我建议您使用插件,那里有许多令人惊叹的Contact Form插件,例如WordPress Contact Form Slider

在这种情况下,您无需编写任何代码,只需配置插件和/或使用简单的短代码即可将其包含在指定页面中。

暂无
暂无

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

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