首页 文章

wordpress主题中的联系页面

提问于
浏览
1

现在我在wordpress工作修改新模板 . 现在我需要在该主题中做联系页面为此我试过这个链接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 -->

3 回答

  • 0

    此代码与联系表单无关,我只是一个基本的页面模板代码 .

    他们正在展示如何创建自定义表单,但您不需要它只需使用Contact Form 7,或者您可以搜索插件目录中提供的许多选项 .

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

  • 0

    如果您使用的是联系表格7,您可以将代码放入这样的模板中(在您已经在WP管理员中设置之后):

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

  • 0

    将自定义代码包含在WordPress主题中并不是一个好主意,因为您将失去使用新的WordPress版本获取主题更新的机会 . 我建议你使用插件,那里有很多很棒的Contact Form插件,比如WordPress Contact Form Slider

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

相关问题