WordPress.org

Forums

NEWBIE Need help with page.php edit (3 posts)

  1. gian132
    Member
    Posted 7 years ago #

    Lately i noticed that even with comments enabled, the comments section would not appear on any of my pages so i made some modifications to page.php and inserted a loop.

    This is the modified page.php below:

    <?php get_header(); ?>

    <div id="primary">
    <div class="inside">
    <div class="utom">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

    <?php link_pages('<p>Pages: ', '</p>', 'number'); ?>
    <?php if (comments_open()) ?>
    <div class="comment-head">
    <h2><?php comments_number('No comments','1 Comment','% Comments'); ?></h2>
    <span class="details">Jump to comment form | <?php comments_rss_link('comments rss'); ?> [?] <?php if ('open' == $post->ping_status): ?>| ">trackback uri [?]</span>
    </div>
    <?php comments_template(); ?>
    <?php endif; ?>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div>
    </div>
    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    It all looks right to me but whenever i open any of my pages, I can still see the comments header <div class="comment-head"> at the bottom of every page regardless of whether comments is disabled or not.

    I am a newbie and made my changes to the page.php after only a 5-minute read of the basic loops section so please, go easy on me.

    Thanks

  2. jwurster
    Member
    Posted 7 years ago #

    What theme are you using? Is the site live?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Your if's and end-if's don't match up right, so I'm not sure how you need to fix them or what you're trying to do...

    This for example:

    <?php if (comments_open()) ?>
    <div class="comment-head">
    <h2><?php comments_number('No comments','1 Comment','% Comments'); ?></h2>

    Doesn't work because the if doesn't have anything to make it apply to the next line. Maybe it needs a colon and an endif, maybe it needs a pair of brackets... I'm not sure what you're trying to do..

    And this:
    <span class="details">Jump to comment form | <?php comments_rss_link('comments rss'); ?> [?] <?php if ('open' == $post->ping_status): ?>| ">trackback uri [?]</span>

    That if statement does have a colon, but the endif; doesn't come before the span closes, so again, I don't know what you're trying to do here.

    Post your code using backtick marks (below the ~ tilde on your keyboard) so that we can see what it actually looks like and figure out what you're trying to do.

Topic Closed

This topic has been closed to new replies.

About this Topic