最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

contact form and WP loop

programmeradmin0浏览0评论

I am trying to learn how to build contact form from scratch without plugin. I came across this tutorial

I am not understanding why we need to put contact form code inside the loop as shown in the tutorial. Out of curiousity I tried putting my code within page-contact.php without using the loop and it was rendered out correctly. I didn't start implementing php code yet. I checked Codex about the_post and the_content tags and what they do within the loop. Say the_content pulls in from database the content of the page or post. So why my markup works without the loop and those tags?

my current page-contact.php

<?php get_header();?>

<main>
     
    <form  method="GET" action="form.html" class="contact">
     
     <div class="field-wrap">
      <div>
        <input type="text" name="name" id="name" required/>
        <label for="name">Name</label>
      </div>

      <div>
        <input type="text" name="email" id="email" required/>
        <label for="email">Email</label>
      </div>
    </div>
    
    
      <div class="message">
        <textarea name="message" id="message" cols="30" rows="25" required></textarea>
        <label for="message">Message</label>
      </div>  

      <button>Submit</button>
    
    </form>

   
</main>    


<?php get_footer();?>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论