I’m trying to use a different comments.php for all posts in one of my categories, so I modified this code in my single.php file:
<?php if (get_option(‘askit_show_postcomments’) == ‘on’) comments_template(”, true); ?>
TO:
<?php if (get_option(‘askit_show_postcomments’) == ‘on’) if (in_category(4403)) { comments_template(‘comments-tutorials.php’); } else { comments_template(”, true); } ?>
In the comments-tutorials.php, I’ve basically copied the original comments.php but changed around a little text specific to that category. Unfortunately, it’s not loading that comments-tutorials.php file, but messing up the comments in that category. Any ideas how I can fix that code?
The topic ‘Comments template for category’ is closed to new replies.
(@futurepocket)
14 years, 10 months ago
I’m trying to use a different comments.php for all posts in one of my categories, so I modified this code in my single.php file:
<?php if (get_option(‘askit_show_postcomments’) == ‘on’) comments_template(”, true); ?>
TO:
<?php if (get_option(‘askit_show_postcomments’) == ‘on’) if (in_category(4403)) { comments_template(‘comments-tutorials.php’); } else { comments_template(”, true); } ?>
In the comments-tutorials.php, I’ve basically copied the original comments.php but changed around a little text specific to that category. Unfortunately, it’s not loading that comments-tutorials.php file, but messing up the comments in that category. Any ideas how I can fix that code?