• Hi my index.php and single.php files are not working properly when i click on other pages of my blog. On the home page (index.php) Everything is displaying right. But when I got to say the About page or Contact page (http://website.com/page. The sidebar and footer do not display properly like how they do on the home page. (http://website.com)

    single.php
    ——————————————————————

    <?php get_header(); ?>

    <div id=”content”>

    <?php if (have_posts()) : ?>

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

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <div class=”post-date”><span class=”post-month”><?php the_time(‘M’) ?></span> <span class=”post-day”><?php the_time(‘d’) ?></span></div>
    <div class=”post-title”>
    <h2><!—<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”> –><?php the_title(); ?></h2>
    <span class=”post-cat”><?php the_category(‘, ‘) ?></span> <span class=”post-comments”><?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></span>
    </div>
    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>
    </div><!–/post –>

    <?php endwhile; ?>

    <div class=”navigation”>
    <span class=”previous-entries”><?php next_posts_link(‘Previous Entries’) ?></span> <span class=”next-entries”><?php previous_posts_link(‘Next Entries’) ?></span>
    </div>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    </div><!–/content –>

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

    ——————————————————————

    index.php

    ——————————————————————

    <?php get_header(); ?>

    <div id=”content”>

    <?php if (have_posts()) : ?>

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

    <h2><!– <?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”> –><?php the_title(); ?></h2>

    <span class=”post-cat”><?php the_category(‘, ‘) ?></span> <span class=”post-comments”><?php comments_popup_link(‘(0 Comments) ‘, ‘(1 Comment) ‘, ‘%(Comments) ;’); ?></span> <span class=”date”><?php the_time(‘M d Y’) ?></span> <div class=”post” id=”post-<?php the_ID(); ?>”>
    <div class=”post-title”>
    </div>
    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>
    </div><!–/post –>

    <?php endwhile; ?>

    <div class=”navigation”>
    <span class=”previous-entries”><?php next_posts_link(‘Previous Entries’) ?></span> <span class=”next-entries”><?php previous_posts_link(‘Next Entries’) ?></span>
    </div>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    </div><!–/content –>

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

    ——————————————————————

    Also I did these files over a tutorial:
    http://www.webdesignerwall.com/tutorials/building-custom-wordpress-theme/

    ——————————————————————

    As you can see I’m calling the sidebar and footer on both but they fail to get them when i click on the other pages.

    Any help will be great.

Viewing 1 replies (of 1 total)
  • Please don’t post huge chunks of code here. For larger blocks of code, use the WordPress pastebin. It makes life easier for everyone.

    Your About and Contact pages won’t use the single.php template file. They’ll use page.php

Viewing 1 replies (of 1 total)
  • The topic ‘index/single.php files will not get_sidebar/footer on other pages’ is closed to new replies.