Title: Removing Comments Section From Page &#8211; PHP Error
Last modified: August 20, 2016

---

# Removing Comments Section From Page – PHP Error

 *  Resolved [hunter86](https://wordpress.org/support/users/hunter86/)
 * (@hunter86)
 * [15 years ago](https://wordpress.org/support/topic/removing-comments-section-from-page-php-error/)
 * Hi everyone,
 * I am trying to modify a template and remove the comments section from a template
   page. But when i remove the php code, I get a syntax error.
 * Here is the full code:
 *     ```
       <?php get_header(); ?>
   
       	<div id="content" role="main" class="span-17 colborder">
   
       	<?php
       	if (have_posts()) {
       		while (have_posts()) {
       			the_post();
       			?>
   
       			<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
   
       				<?php
       				if (get_post_meta($id, 'show_headline', true) !== '0') {
       					echo '<h1>'; the_title(); echo '</h1>';
       				}
   
       				if (!is_page()) {
       					?>
       					<p class="postmetadata">
       						<?php the_time(get_option('date_format')); ?> by <?php the_author(); ?>
       					</p>
       					<?php
       				}
       				?>
   
       				<div class="entry">
       					<?php the_content('Read more &raquo;'); ?>
       				</div>
   
       				<?php wp_link_pages(); ?>
   
       			</div>
   
       			<?php
       		}
       	}
       	else {
       		?>
       		<h2>Not Found</h2>
       		<p>The content you have requested does not exist.</p>
       		<?php
       	}
   
       	comments_template();
       	?>
   
       	</div><!-- id="content" -->
   
       <?php get_sidebar(); ?>
   
       <?php get_footer(); ?>
       ```
   
 * I remove this line
 *     ```
       <?php
       	}
   
       	comments_template();
       	?>
       ```
   
 * And I get this error:
 * > Parse error: syntax error, unexpected $end in ……. on line 48
 * I am absolutely new to php so I am sure there is something simple I am missing.
 * Thanks in advance for the help!
 * – Hunter

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [oh_hello](https://wordpress.org/support/users/oh_hello/)
 * (@oh_hello)
 * [15 years ago](https://wordpress.org/support/topic/removing-comments-section-from-page-php-error/#post-2099715)
 * Why don’t you just change the setting in WordPress admin to disable comments,
   then you wouldn’t have to edit the template at all.
 *  Thread Starter [hunter86](https://wordpress.org/support/users/hunter86/)
 * (@hunter86)
 * [15 years ago](https://wordpress.org/support/topic/removing-comments-section-from-page-php-error/#post-2099750)
 * Oooooh, yeah… That might work…
 * Feeling very silly!
 * Thanks!
 * – Hunter

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Removing Comments Section From Page – PHP Error’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [hunter86](https://wordpress.org/support/users/hunter86/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/removing-comments-section-from-page-php-error/#post-2099750)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
