Forums

[resolved] duplicating div tag for main posts (6 posts)

  1. digitalmonkey
    Member
    Posted 2 years ago #

    hey all, I'm having this problem where I've placed my main post in a div tag only when I add a new post the div tag doesn't close, instead I have to add a new </div> inside my index php the close up the tag.
    I hope I explained to right but if not here's the code in the php.

    <?php get_header(); ?>
    
           <?php if (have_posts()) : ?>
    
    	    <?php while (have_posts()) : the_post(); ?><title>site orignal</title>
    
                <div id="content">
                     <div id="blog-<?php the_ID(); ?>" class="blog">
                     <p class="date"><?php the_time('F')?><br />
                     <span><?php the_time('jS')?></span></p>
                       <div class="blog_small">
    
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
    <p><?php the_tags('Tags: ', ', ', '<br />'); ?></p> 
    
    <div class="entry"><?php the_content('Read the rest of this entry &raquo;'); ?></div>
    
    <div class="hr"></div>
    
    <p><?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p><br />
    
    <div class="hr"></div>
    			</div>
    </div>
    		<?php endwhile; ?>
    
    		<div class="right">
    		<ul>
    			<li><?php next_posts_link('&laquo; Older Entries') ?></li>
    			<li><?php previous_posts_link('Newer Entries &raquo;') ?></li>
    		</ul>
    		</div>
    	<?php else : ?>
    
    		<p>Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
                        <div class="pagination">
                        <div class="right"><a href="http://www.bhlablhaa.com/index.php/page/2/">Older Entries &raquo;</a></div>
                        <div class="left"></div>
                        </div>
    
    </div> <!-- content end -->
    </div>
    </div>
    </div>
    </div><!-- column-left end -->
    
    <?php get_sidebar(); ?>
    
    <br style="clear:both;" />
    
    </div> <!-- Container end -->
    <?php get_footer(); ?>

    </div> <!-- content end -->
    </div>
    </div>
    </div>
    </div><!-- column-left end -->

    this where the div tag (div "content")contains the main post should end however I had to add 3 more </div> to end the new post I've just added. Is there away so that the div can be automatically close itself with every post?

  2. alchymyth
    The Sweeper
    Posted 2 years ago #

    try putting a closing </div> just before
    <?php endwhile; ?>
    that should close the #content.

    btw: are you displaying more than one post on the page?

  3. digitalmonkey
    Member
    Posted 2 years ago #

    thanks alchymyth, I tried it and it didn't work. :( also I am having one post on a page.

  4. digitalmonkey
    Member
    Posted 2 years ago #

    I think I know what the problem is only I don't know how to fix it.

    The content div should enclose all the posts, only on the htlm of the site there's many 'content' divs.

    here's the code from the html:

    <div id="content">
                     <div id="blog-44" class="blog">
                     <p class="date">November<br />
                     <span>20th</span></p>
    
                       <div class="blog_small">
    
    <h2><a href="http://www.bhalah.com/wordpress/?p=44" rel="bookmark" title="Permanent Link to asa">asa</h2>
    <p>Tags: <a href="http://www.blahaha.com/wordpress/?tag=test" rel="tag">test</a><br /></p> 
    
    <div class="entry"><p>gfggggggggggggggggggggggggggxxxxxgggggggggggc vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvbx</p>
    </div>
    
    <div class="hr"></div>
    
    <p><a class="post-edit-link" href="http://www.blahah.com/wordpress/wp-admin/post.php?action=edit&post=44" title="Edit post">Edit</a> |   <a href="http://www.blahah.com/wordpress/?p=44#respond" title="Comment on asa">No Comments »</a></p><br />
    
    <div class="hr"></div>
    			</div>
    </div>
    		<title>site orignal</title>
    
                <div id="content">
                     <div id="blog-36" class="blog">
                     <p class="date">November<br />
                     <span>18th</span></p>
    
                       <div class="blog_small">
    
    <h2><a href="http://www.bhalal.com/wordpress/?p=36" rel="bookmark" title="Permanent Link to this new">this new</h2>
    <p>Tags: <a href="http://www.bhalala.com/wordpress/?tag=test" rel="tag">test</a><br /></p> 
    
    <div class="entry"><p>test on alignmen.</p>
    <p><img class=" alignnone" src="http://www.din-2.jpg" alt="nbnvgnv" width="375" height="300" /></p>
    <p><img src="file:///C:Temp/moz-screenshot-1.png" alt="" /><img src="file:///C:Temp/moz-screenshot-2.png" alt="" /></p>
    <p><img src="file:///C:/Temp/moz-screenshot.png" alt="" /></p>
    </div>
    
    <div class="hr"></div>
    
    <p><a class="post-edit-link" href="http://www.bhalal.com/wordpress/wp-admin/post.php?action=edit&post=36" title="Edit post">Edit</a> |   <a href="http://www.bhahal.com/wordpress/?p=36#respond" title="Comment on this new">No Comments »</a></p><br />
    
    <div class="hr"></div>
    			</div>
  5. digitalmonkey
    Member
    Posted 2 years ago #

    Okay I fixed it. What I did was to move the 'content' div above ?php if (have_posts()) : ?> and deleted the extra </div>

  6. digitalmonkey
    Member
    Posted 2 years ago #

    btw does anyone know the code to turn the month from a fully written month ie: November to Nov?

    Edit: found it. It's 'M'.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags