• Hi all, I’d be thrilled if somebody could help me out with a simple problem.

    I’ve added two extra comment forms on my newspaper site (so that I could customize the default posting instructions depending on which category the comment form is on.) I created the new comment forms by duplicating the original comments.php file, modifying some of the default text, then saving with new names (e.g., comments-obits.php). Other than that, I didn’t change any of the code from the original comments.php file.

    The new forms display fine where they are supposed to. And, they seem to work fine, as comments posted through them are logged and the comment count is updated with each new post. (And, I can see them in the Comments admin area too.)

    But, here’s the problem. Comments are not displaying on the pages that reference the new form.

    There must be something I need to modify on the new comments-obits.php file, as comments do display on the pages referencing the original comments.php file.

    I hope I explained this clearly enough. Can anybody point out what needs to be changed? Or, is there a better way to accomplish what I’m trying to do — which is simply to customize the default “Leave a Comment” text associated with the form depending on which category it’s in.

    Thank in advance!

Viewing 1 replies (of 1 total)
  • Not sure of the best way to do this. But there are a number of less ambitious ways than you have tried.

    I would delete the duplicate comment template, and instead you make use of the following piece of code. I haven’t tested it, but it should work. Change the category IDs in the code to match the categories you want to customize the instructions for, then put it in your theme.

    //if the category ID is 1 or 2 do something
    <?php if ( in_category(1,2) ) { ?>
    //if the category ID is 1
    <?php if ( in_category(1) ) { ?>
    //Show the following text
    <p>This is your instructions for posting comments.</p>
    //if the category ID is not 1, it must be 2
    <?php } else { ?>
    //so show this text
    <p>This is your instructions for posting comments.</p>
    <?php } ?>
    //if the category ID is not 1 or 2
    <?php } else { ?>
    //show the default text
    <p>This is your defualt instructions for posting comments.</p>
    <?php } ?>

Viewing 1 replies (of 1 total)

The topic ‘Help with configuring multiple comment forms on single site’ is closed to new replies.