• 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?

Viewing 11 replies - 1 through 11 (of 11 total)
  • try

    <?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>

    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?

    Just found the answer to the second part, but the different comments.php templates still eludes me.

    The second part:

    https://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);
    }
    ?>

    ??

    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);
    }
    ?>
    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    The first line is wrong.

    if (file_exists(TEMPLATEPATH.DIRECTORY_SEPARATOR.'comments2.php')){

    Use that instead.

    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 ‘{‘

    Chaoskaiser:

    Apologies, your first line of code does work.

    <?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>

    lol

    Thread Starter jungledsales

    (@jungledsales)

    chaoskaizer: Thanks. The first code suggestion worked.

    <?php comments_template(DIRECTORY_SEPARATOR.'comments2.php'); ?>

    richarduk: I used Ryan Boren’s plugin at https://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.

    jungledsales

    Thanks ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘comments2 instead of <?php comments_template(); ?>’ is closed to new replies.