I’m trying to style a form on a website, but I’m hitting a snag. WordPress is automatically generating <br>
tags when I directly edit the HTML for pages.
What I’ve got is this:
<fieldset>
<legend>* Your name:</legend>
<ul class="singleLine">
<li>
<span>
<input id="FName" type="text" name="FName" size="20" maxlength="20" />
<label for="FName">First</label>
</span>
<span>
<input id="LName" type="text" name="LName" size="30" maxlength="40" />
<label for="LName">Last</label>
</span>
</li>
</ul>
</fieldset>
…all mashed together into a single line because WP wants to generate <br>
tags all over the place if I don’t. I can deal with that, but I’m actually still getting <br>
tags generated directly after each<span>
tag in the resulting page even with all of the HTML smooshed together on one line. How do I get rid of those?
Thanks!
Edit: Here’s the portion of the layout that generates the page content.
<div id="main-content">
<?php while( have_posts() ) : the_post() ?>
<h1 id="pagetitle"><?php the_title(); ?></h1>
<div class="pagecontent">
<?php get_the_content() ?>
</div>
<?php endwhile ?>
</div>
replacing get_the_content()
with the_content()
renders properly.
Try using
get_the_content();
in your page template loop instead ofthe_content();
EDIT 05/24/2012 – Try this:
P.S. You will also need to consider the rest of your more “normal” wordpress pages through out your site.
You don’t want ALL of your pages functioning like that. I would create a page template for the pagess that need to function this way, the rest of your pages should use the normal page.php template.
Learn more on page templates.