• Resolved hunter86

    (@hunter86)


    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)
  • 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

    (@hunter86)

    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.