Forums

How to include a different comment-template for each category (3 posts)

  1. Jaja..
    Member
    Posted 1 year ago #

    Hello,

    I'm making a custom WordPress site build on the TwentyTen theme but i have some question.

    What i'm making? a small website with only 3 categorys and each category and blog-post is getting it's own fully custom styled layout.
    Everything is working fine till now i have duplicated the category.php file like this: category-6.php <-- for showing off category ID 6.
    after that i have done the same thing with the loop-category.php and created for each category it's own loop by turning it into loop-category-web.php loop-category-print.php and loop-category-others.php same i did for the sidebar.php and fooer.php and include them like this:

    <?php include ('sidebar-web.php'); ?>
    <?php include ('footer-web.php'); ?>

    Like it said everything works fine only when it comes to the comment section it gets a little bit outside my league because i'm not good at .php.
    Now i want to do the same '3' files-'transform' trick for the comment section so i can style each input field differently.

    After searching i see this line of code inside the single-web.php, single-print.php and single-others.php.
    <?php comments_template( '', true ); ?>

    If i understand this .php line of code correctly, it calls the comment-template.php file inside the wordpress includes folder.

    Now i have duplicated the comment-template.php file 3 times into comment-template-web.php, comment-template-print.php and comment-template-others.php
    But how do i call them to be written by each singel-...php file?

    I tried to do this:

    <?php comments_template_web( '', true ); ?>
    and
    <?php comments_template_print( '', true ); ?>
    and
    <?php comments_template_others( '', true ); ?>

    Only this doesn't work i get none comments at all so this means i have broken the comment-script.

    It would be so great if somebody can help me out here, maybe it's very easy but i don't see what to do.

    Thanks.

  2. stevejohnson
    Member
    Posted 1 year ago #

    <?php comments_template('/comments_template_web.php', true); ?>

  3. Jaja..
    Member
    Posted 1 year ago #

    Thank you..

Topic Closed

This topic has been closed to new replies.

About this Topic