WordPress.org

Ready to get started?Download WordPress

Forums

index/single.php files will not get_sidebar/footer on other pages (3 posts)

  1. nickelbert
    Member
    Posted 4 years ago #

    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(); ?>

    ------------------------------------------------------------------

    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.

  2. nickelbert
    Member
    Posted 4 years ago #

  3. pioneerka
    Member
    Posted 4 years ago #

    If you want to see some changes on your page, then why do you edit single.php and not page.php?

Topic Closed

This topic has been closed to new replies.

About this Topic