comment template problem
-
The functions.php file for your theme.
i don’t think it does anything with the comments form, only with the comments in feed and sidebar.
See functions.php: http://wordpress.pastebin.ca/1568760
Try updadting these lines in the single.php
<ul> <?php if ( in_category('62') ) { include(TEMPLATEPATH . '/sidebar-deriepel.php'); } else if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?> <?php include (TEMPLATEPATH . '/sidebar-2.php'); ?> <?php endif; ?> </ul> </div> </div>to..
<ul> <?php if ( in_category('62') ) { include(TEMPLATEPATH . '/sidebar-deriepel.php'); } else { if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : include (TEMPLATEPATH . '/sidebar-2.php'); endif; } ?> </ul> </div> </div>Looks like there were some minor mistakes there, see if that helps..
Sorry, it doesn’t work, doesnt change a thing (but doesn’t do any harm either).
In page.php I removed the complete comments form and that doesn’t give any problems. Isn’t there a way to use single.php for all posts, but single2.php for all posts that belong to a certain category? Then I can remove the comments form in single2.php (like in page.php) and hopefully the problem is solved then?
Could this work and if yes, how do I do this?
No need for that just wrap the comments_template call in a condition..
<?php if(!in_category('XX')) { comments_template(); } ?>So if not
!in category XX, where XX is the ID or category name/slug.there is only one category where i don’t want comments enabled, so let’s say this is category id 63. What must the code look like then? In single.php the only call to comments is:
<?php comments_template(); ?>I’ve found a different solution.
I’ve added the following code to my themes functions.php:
add_filter(‘single_template’, create_function(‘$t’, ‘foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . “/single-{$cat->term_id}.php”) ) return TEMPLATEPATH . “/single-{$cat->term_id}.php”; } return $t;’ ));now when i create a single-xx.php (where xx is the ID of the category) all posts in this category use the single-xx.php instead of single.php.
The topic ‘comment template problem’ is closed to new replies.
(@ronaldb73)
16 years, 8 months ago
I have the following problem:
In general I let people react to any post on the site and all works fine. But with some posts I want to disable the comment option. Problem is that whenever I uncheck the comment option and save the post, the sidebar drops below the post.
I’ve counted all the div’s and /div’s and that’s not the problem. Anyone have any idea what could cause this?
OR
Can anyone tell me how to NOT load the comments template in some categories?