comments off from page.php
-
In my page.php I don’t want to display the comments form.
How do I take it off please?Thanks
-
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 🙂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(); ?><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. 🙂
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
Where you took out
<?php comments_template(); // Get wp-comments.php template, put back:
endwhile; else: ?>
<?php endwhile; else: ?>(I think).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.
thanks IanD it helped 🙂
The topic ‘comments off from page.php’ is closed to new replies.