WordPress.org

Support

Support » Themes and Templates » NEWBIE Need help with page.php edit

NEWBIE Need help with page.php edit

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • What theme are you using? Is the site live?

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘NEWBIE Need help with page.php edit’ is closed to new replies.