简体   繁体   中英

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

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.

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):

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

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. I recommend you to use plugins, there are many of amazing Contact Form plugins are out there, like 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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