jungledsales
Member
Posted 3 years ago #
I have substituted <?php include (TEMPLATEPATH . '/comments2.php'); ?> for <?php comments_template(); ?> on my single-2 template but I lose all my comments. The form still shows up fine but no comments show up.
I tried troubleshooting by mirroring comments.php and comments2.php to start with but I still have the same issue. I think it has something to do with the comment-template.php in the wp-include folder.
Any suggestions how to get my comments2.php to show my comments?
try
<?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>
richarduk
Member
Posted 3 years ago #
I have an identical problem to jungledsales
Chaoskaizer, your code produces a fatal error
I didn't know that you could have different single.phps
How's that done?
richarduk
Member
Posted 3 years ago #
Just found the answer to the second part, but the different comments.php templates still eludes me.
The second part:
http://wordpress.alanwho.com/different-single-post-pages-in-wordpress/
<?php
$post = $wp_query->post;
if ( in_category('2') ) {
include(TEMPLATEPATH . '/single-blog.php'); }
elseif ( in_category('15') ) {
include(TEMPLATEPATH . '/single-photography.php'); }
elseif ( in_category('18') ) {
include(TEMPLATEPATH . '/single-video.php'); }
else {
include(TEMPLATEPATH . '/single-default.php');
}
?>
Chaoskaizer, your code produces a fatal error
@richarduk: well its depend on who's asking?
why dont u try the following richarduk
<?php
if (file_exists('TEMPLATEPATH.DIRECTORY_SEPARATOR.'comments2.php''){
comments_template(DIRECTORY_SEPARATOR.'comments2.php');
} else {
trigger_error(__('stupids! I don\'t have that file yet'), E_USER_ERROR);
}
?>
richarduk
Member
Posted 3 years ago #
:-)
The error is this:
Parse error: syntax error, unexpected T_STRING
Even when I use this:
<?php
if (file_exists('TEMPLATEPATH.DIRECTORY_SEPARATOR.'comments2.php''){
comments_template(DIRECTORY_SEPARATOR.'comments2.php');
} else {
trigger_error(__('Hmmm - I do have that file and it sill does not work'), E_USER_ERROR);
}
?>
The first line is wrong.
if (file_exists(TEMPLATEPATH.DIRECTORY_SEPARATOR.'comments2.php')){
Use that instead.
richarduk
Member
Posted 3 years ago #
Still not working, though I've tried all sorts of permutations.
<?php
if (file_exists(TEMPLATEPATH.DIRECTORY_SEPARATOR.'comments2.php'){
comments_template(DIRECTORY_SEPARATOR.'comments2.php');
} else {
trigger_error(__('Hmmm - I do have that file and it sill does not work'), E_USER_ERROR);
}
?>
Parse error: syntax error, unexpected '{'
richarduk
Member
Posted 3 years ago #
Chaoskaiser:
Apologies, your first line of code does work.
<?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>
jungledsales
Member
Posted 3 years ago #
chaoskaizer: Thanks. The first code suggestion worked.
<?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>
richarduk: I used Ryan Boren's plugin at http://boren.nu/archives/2005/03/13/custom-post-templates-plugin/ to create multiple templates for single.phps
It's especially nice since you can do each category individually like you do in your code above or you can have it display a unique template based on the post ID. Very cool stuff.
richarduk
Member
Posted 3 years ago #