Forums

[resolved] [elegant-grunge] Adding Comments to Pages (6 posts)

  1. Mixerious
    Member
    Posted 8 months ago #

    Hey everybody,

    I´m having a big problem with my wordpress Blog http://www.diskaster.de . I´m using the popular elegant-grunge theme, but comments aren´t supported for Pages, only Entries at the main page. So I made a new page.php Template and copied the old one with adding the comments from the single.php

    My page.php now looks like this:

    <?php get_header(); ?>
    
    <div id="content-container">
    <div id="content">
    <div id="body">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content(__('<p class="serif">Read the rest of this page &raquo;</p>', 'elegant-grunge')); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>'.__('Pages:', 'elegant-grunge').'</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    
    					<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    						// Both Comments and Pings are open ?>
    						<?php printf(__('You can %1$sleave a response%2$s, or %3$strackback%4$s from your own site.', 'elegant-grunge'),
    							'<a href="#respond">', '</a>', '<a href="'.get_trackback_url().'" rel="trackback">', '</a>') ?>
    
    					<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    						// Only Pings are Open ?>
    						<?php printf(__('Responses are currently closed, but you can %1$strackback%2$s from your own site.', 'elegant-grunge'),
    							'<a href="'.get_trackback_url().'" rel="trackback">', '</a>') ?>
    
    					<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    						// Comments are open, Pings are not ?>
    						<?php _e('You can skip to the end and leave a response. Pinging is currently not allowed.', 'elegant-grunge') ?>
    
    					<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    						// Neither Comments, nor Pings are open ?>
    						<?php _e('Both comments and pings are currently closed.', 'elegant-grunge') ?>
    
    				</div>
    			</div>
    			<div class="hr"><hr /></div>
    
    	<?php comments_template(); ?>
    
    	<?php endwhile; else: ?>
    		<?php edit_post_link(__('Edit this entry.', 'elegant-grunge'), '<p>', '</p>'); ?>
    
    </div>
    
    <?php if ( get_option('page_setup') != 'no-sidebar' ) get_sidebar(); ?>
    </div>
    
    <div class="clear"></div>
    </div>
    
    <?php get_footer(); ?>

    When I´m using this template I´m getting this error:

    Parse error: syntax error, unexpected $end in /is/htdocs/wp1008248_DQDYVOL00R/www/diskaster/wordpress/wp-content/themes/elegant-grunge/page.php on line 51

    I have very limited PHP Skills but I´ve got some good programming skills, so I know some basic php things. Could you please tell me whats wrong? Do i have to put the comment code somewhere else? I Appreciate every help!

  2. Mixerious
    Member
    Posted 8 months ago #

    It´s very easy: Instead of the messy code I added, just add <?php comments_template(); ?> in the page.php where you want the comments to appear.

  3. 5ummer5
    Member
    Posted 7 months ago #

    I tried just adding that <?php comments_template(); ?> but it messes up the look of the theme. I get an additional grey like added and also the sidebar gets pushed down.

    Did you have these issues too? If so how did you resolve them?

    Thank you for your help.

  4. 5ummer5
    Member
    Posted 7 months ago #

    sorted it!

    The code <?php comments_template(); // Get wp-comments.php template ?> needed to go directly after <?php endwhile; ?>

  5. tywerx
    Member
    Posted 6 months ago #

    That just didn't work for me

    Can someone help me figure this out?
    I'm stumped.

    Ty

    http://www.markgrowden.org/blog

  6. a.q.s.
    Member
    Posted 2 months ago #

    It didn't work for me either.

    does it go after <?php endwhile; ?> or after <?php endwhile; endif; ?>

    thanks for any help.

    annie

Reply

You must log in to post.

About this Topic