• Resolved sarahlaw

    (@sarahlaw)


    Hey everyone,

    If you have a look at http://www.nadialouiseimages.com/news you will see that the post titles, eg. “Hello World”, are out of the grey boxes where the post content is.

    I am trying to get these post titles into the grey boxes. I have tried moving a lot of the code into div layers, but it still seems to be above the box. However, if you click on the comments, the title is in the box (as I would like it to be).

    I bet it’s something simple, but it’s just beyond me right now.

    I would appreciate any help or suggestions on how to fix this.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi

    You need to move your post title/link code inside the Div’s

    What you have now looks like this

    <div class="top">
       <h2><a href="http://www.nadialouiseimages.com/news/?p=1">Hello world!</a></h2>
       <div class="bottom">
           <p class="categor"><strong>Posted:</strong> under <a rel="category" title="View all posts in Uncategorized" href="http://www.nadialouiseimages.com/news/?cat=1">Uncategorized</a>.<br /></p>

    It wants to look like this:
    <div class=”top”>
    <div class=”bottom”>
    <h2>Hello world!</h2>
    <p class=”categor”>Posted: under Uncategorized.
    </p>
    `

    I took this from View Source – what you are actually going to see will be partially PHP code. Just move the code that sets up the <h2> </h2> inside the Div that’s below it. That will put it in the grey box area.

    Thread Starter sarahlaw

    (@sarahlaw)

    Hey,

    If you have a look at the php code below, it’s already set out with nothing in “top” (in single.php), which is why I’m wondering why it’s not working.

    Any ideas?

    <?php get_header(); ?>
    
    <!-- Start of Two Column Fixed Body -->
     <div id="main">
    	<div id="right">
    	    <?php
    		if (have_posts())
    		{
    	        while (have_posts())
    		{
    		the_post();
    		?>
    <div id="page-<?php echo the_ID();?>" class="<?php echo $alternate;?>">
    <div class="back">
    <div class="top">
    <div class="bottom">
    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    <p class="categor"><strong>Posted:</strong> <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?>.
    <?php the_tags('Tags: ', ', ',''); ?><?php edit_post_link('[e]',' | ',''); ?>
    
    <!--
    
    <h4><a href="<?php the_author_url(); ?>"><?php the_author() ?></a> at <?php the_date() ?> : <?php the_time() ?>  <?php edit_post_link(__('Edit This')); ?></h4>
    
    -->
    
    <?php if ( get_post_meta($post->ID, 'heading', true) )
    {
    ?>
    
    <h4><?php echo get_post_meta($post->ID, "heading", $single = true); ?></h4>
    
    <?php
    }
    ?>
    
    <div class="post-body">
    
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    
    </div>
    
    <div id="comment">
    
    <?php comments_template(); ?>
    
    </div>
    </div>
    <?php
    
    }
    ?>
    
    <?php
    }else{
    // No Post Found
    ?>
    
    <div id="errobox" style="padding-left:10px">
    <h2 class="center">404 Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.
    
    </div>	
    
    <?php
    }
    ?>
    </div>
    </div>
    </div>
    </div><!-- End of Column Left -->
    
    	<div id="left">
              <?php get_sidebar(); ?>
    	</div><!-- End of Column Right -->
    	<div style="clear:both"></div>
    </div>
    <!-- End of Two Column Fixed Body -->
    
    <?php get_footer(); ?>

    Hi – That one looks correct – your home page looks correct also. There are a number of templates that WP uses to put a site together. Its possible the one whose code you posted is not the one that has the problem.

    The main ones you want to look at are
    index.php
    page.php
    category.php
    archive.php
    single.php

    Make sure the code in all those looks the same as what you posted.

    Thread Starter sarahlaw

    (@sarahlaw)

    Thanks so much, in the time I’ve just gone and found the problem – it was in showposts.php, in a very sneaky place I wouldn’t have noticed otherwise.

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘trouble aligning post titles’ is closed to new replies.