WordPress.org

Ready to get started?Download WordPress

Forums

comments off from page.php (8 posts)

  1. ugua
    Member
    Posted 8 years ago #

    In my page.php I don't want to display the comments form.
    How do I take it off please?

    Thanks

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    Open page.php
    There will be two elements you need to remove. One looks similar to this:

    <div class="feedback">
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    </div>

    The other is
    <?php comments_template(); // Get wp-comments.php template ?>

    Removing them will do the trick.
    If you hit a problem, let us know what theme you have and we can get exact advice :)

  3. ugua
    Member
    Posted 8 years ago #

    Here is my template:

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

    <div class="entry<?php if(is_home() && $post==$posts[0] ) echo ' firstpost';?>">
    <!--<h2 class="entrydate">
    <?php the_date() ?>
    </h2> --><h3 class="entrytitle" id="post-<?php the_ID(); ?>"> " rel="bookmark">
    <?php the_title(); ?>
    </h3> <div class="entrymeta">
    <?php edit_post_link(__('Edit')); ?>
    </div>

    <div class="entrybody">
    <?php
    the_content(__('(Read the article)'));
    ?>
    <p class="comments_link">
    <?php
    $comments_img_link = '<img src="' . get_stylesheet_directory_uri() . '/images/comments.gif" title="comments" alt="*" />';
    comments_popup_link(' Comments(0)', $comments_img_link . ' Comments(1)', $comments_img_link . ' Comments(%)');
    ?>

    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>
    <?php comments_template(); // Get wp-comments.php template
    endwhile; else: ?>

    <?php _e('Sorry, no posts matched your criteria.'); ?>

    <?php
    endif;

    ?>

    </div>
    <?php get_sidebar(); ?>
    <!-- The main column ends -->
    <?php get_footer(); ?>

  4. ladydelaluna
    Member
    Posted 8 years ago #

    <p class="comments_link">
    <?php
    $comments_img_link = '<img src="' . get_stylesheet_directory_uri() . '/images/comments.gif" title="comments" alt="*" />';
    comments_popup_link(' Comments(0)', $comments_img_link . ' Comments(1)', $comments_img_link . ' Comments(%)');
    ?>

    and

    <?php comments_template(); // Get wp-comments.php template
    endwhile; else: ?>

    remove those. :)

  5. ugua
    Member
    Posted 8 years ago #

    I deleted the second code u said and:

    Parse error: parse error, unexpected T_ENDIF in /home/dfsfsdfsdf/public_html/wp2/wp-content/themes/ftiny/page.php on line 35

  6. iand
    Member
    Posted 8 years ago #

    Where you took out <?php comments_template(); // Get wp-comments.php template
    endwhile; else: ?>
    , put back:
    <?php endwhile; else: ?> (I think).

  7. ladydelaluna
    Member
    Posted 8 years ago #

    sorry - i missed the last part...

    i think it's this:

    <?php comments_template(); // Get wp-comments.php template
    endwhile; else: ?>

    <?php _e('Sorry, no posts matched your criteria.'); ?>

    <?php
    endif;

    ?>

    that has to go.

  8. ugua
    Member
    Posted 8 years ago #

    thanks IanD it helped :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags