Jump to content

Stuck creating my own Template


Andrea

Recommended Posts

I've watched the University video 3 times now - and while I had no problem following it exactly, I'm trying to design just a little differently than Jon. Mainly, I want to keep my sidebar on all pages. No problems - BUT on the index page. Seems that no matter what I try, things aren't lining up. I cannot seem to get a content div around the relevant section.

 

I did code a little differently than Jon - mainly, using IDs where things are obvious one-time events per page, and different names - his homesplash is my indexPage, his class canvas is my ID wrapper - stuff like that. The wordpress link in my footer takes you to my work-in-progress, and the actual code on the header and page page are here. Of course, by now I probably messed things up even more, trying to fix this.

 

Header Page




<?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?>




<?php wp_head(); ?>




<?php bloginfo('name'); ?>
<?php bloginfo('description'); ?>

               <?php wp_list_pages('title_li='); ?>


           <?php if (is_page('Home')) : ?>



           <? endif; ?>

Page Page

<?php get_header(); ?>
<?php if (is_page('Home')) : ?>


       <?php
       $post = get_post();
       echo $post ->post_content;
       ?>


       <?php else: ?>

       <?php if (have_posts()) : ?>
       <?php while (have_posts()) : the_post(); ?>


<?php the_content('Read More ....'); ?>


           <?php endwhile; ?>

<?php next_posts_link('< Older Entries'); ?>
<?php previous_posts_link('Newer Entries >'); ?>

           <?php else : ?>
Not Found

… and you still haven't found what you're looking for (sing it, Baby)
       <?php endif; ?>


       <?php endif; ?>

       <?php get_sidebar();?>
       <?php get_footer(); ?>

Link to comment
Share on other sites

This is just an educated guess... but based on this section of code:

 



       $post = get_post();
       echo $post ->post_content;
       ?>


 

It appears that your template doesn't include a "

" section for the home page. Basically, the code for this page says "if this page is the home page, use this specific content (a p tag, plus content from the database), but if it's a non home page, use a slightly different content.

 

I believe that you'd need to add your div within the first if block, like so:

 

[b][/b]


       $post = get_post();
       echo $post ->post_content;
       ?>

[b][/b]

Link to comment
Share on other sites

I should mention that this section within your header doesn't really do anything:

 




endif; ?>

 

If you look at your source code for the rendered page, I'm pretty sure you'll find an empty "

near the top of the home page. This issue is that this code doesn't wrap anything, since the order the template files are displayed is

 

-- header

-- page

-- footer

 

You could fix this either with the code in my previous post, or editing your header to remove the closing div:

 

 

And then adding that closing div to the first line of the footer.php file:

 


endif; ?>




endif; ?>

Link to comment
Share on other sites

Thanks Ben - I'll look into it tonight. I think the empty indexPage ID is one of the set-up steps - I was trying to get the content stuff INSIDE that id, but haven't figured it out yet. Anyway- I'll keep plugging away.

Link to comment
Share on other sites

Ben - I got it. You didn't have the right answer, but what you said directly led me to the solution - that closing div etc needed to go to sidebar.php.

 

 

EDIT --- or putting it to the bottom of page.php just above the sidebar include seems to work, too - and might make more sense. Either way, I think I just got a better grasp on the concept.

 

Thank You!!!

 

lm --- are you saying I have an unclosed div tag somewhere? How embarrassing :o

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...