• Hi,

    WordPress is putting an extra opening <div> tag into my pages. Please review the code below, and not the double occurrence of <post-content>

    This is my loop:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
        	<div class="post-headin"><h2><?php the_title(); ?></h2></div>
        	<div class="post-content">
          		<?php the_content(); ?>
            </div>
                      <p class="postmetadata">
                <?php edit_post_link('Edit', ' | ', ''); ?>
                </p>
    
    	</div>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    This is the output

    <div class="post" id="post-14">
        	<div class="post-headin"><h2>Experience + Reputation</h2></div>
        	<div class="post-content">
    
             <div class="post-content">
    <p>Yada yada yada</p>
             </div>
    
            </div>
            <p class="postmetadata">
                 | <a class="post-edit-link" href="https://www.islandscapetransformations.com.au/wp-admin/post.php?action=edit&post=14" title="Edit post">Edit</a>            </p>
    
    	</div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there. I just had this problem. It was caused because the <?php endwhile; ?> tag was inserted prior to the end of the appropriate tag.

    I hope you figured it out by now. ??

    Thread Starter pblk

    (@pblk)

    I cant see what you mean in my version???

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress inserts opening <div> tag twice.’ is closed to new replies.