Remove Comments Template from Network Theme

Hi there,
Where can I delete the comments template for my blog posts on the Network theme? I am using a child theme.

I have done this easily on twentyeleven, etc., but given the complexity of this theme (I have searched through all the files) I cannot find where to do it! And yes, I do want the comments template completely removed, so it does not say, comments closed, etc. anywhere on the site...
thanks!
cmccb

  • DavidM

    Hi cmccb,

    The "Comments are closed" message only appears in comments.php in the theme's folder and potentially you could hide the message with the following css:
    p.comments-closed pings-open, p.comments-closed { display:none; }

    However, it would be best to just remove lines 50 and 54 of comments.php in a child theme.

    There's still occurrences of "No comments" within the \network\library\functions\loop-functions.php and for those, you'd have to edit out all of those within that file, a bit of an extensive edit, but hopefully you won't need to remove those bits!

    Hope this helps!

    -David

  • Mason

    Hiya,

    Copy the single.php from the parent to the child theme.

    Open it and modify line 12 if using buddypress or line 14 if not. Just change it to be a unique function for example:
    <?php mj_wpmu_singleloop(); ?>

    Then open your functions.php and copy the loop from the loop-functions.php file in the parent theme. Edit this function to remove the references to the comment form and rename it to match what you applied to the single.php.

    For example, if I modified the BuddyPress function (line 12) to the above, this is what the new portion in functions.php would look like:

    function mj_wpmu_singleloop(){
    		rewind_posts();
    		while (have_posts()) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<div class="author-box">
    					<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
    					<p><?php _e( 'by ', 'network' ) ?><?php the_author_link();  ?></p>
    				</div>
    				<div class="post-content">
    					<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'network' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    					<p class="date"><?php the_time('M j Y') ?> <em><?php _e( 'in', 'network' ) ?> <?php the_category(', ') ?> <?php _e( 'by ', 'network' ) ?><?php the_author_link();  ?></em></p>
    					<div class="entry">
    						<?php the_content( __( 'Read the rest of this entry &rarr;', 'network' ) ); ?>
    					</div>
    					<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'network' ), ', ', '<br />'); ?></span></p>
    				</div>
    			</div>
    
    			<?php endwhile;
    }
    add_action('mj_wpmu_singleloop', 'mj_wpmu_single_loop');

    Save both files and you're good to go. Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.