• Resolved nemci7v

    (@nemci7v)


    Hello, Happy Easter! ??

    I’m trying to change the “Comments” heading into “Answers” but just on some specific categories.

    This is the code I tried in comments.php

    <?php
    if ( in_category( '2520' )) {
    <h3><?php _e('Answers', 'genesis'); ?></h3>
    } elseif ( in_category( array( '2701', '2702' ) )) {
    <h3><?php _e('Answers', 'genesis'); ?></h3>
    } else {
    <h3><?php _e('Comments', 'genesis'); ?></h3>
    }
    ?>

    but I get Parse error: syntax error, unexpected ‘<‘ on line 18 which is

    <h3><?php _e('Answers', 'genesis'); ?></h3>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes you’re not switching between php/html quite right, try this instead.

    <?php if ( in_category( '2520' )) { ?>
    <h3><?php _e('Answers', 'genesis'); ?></h3>
    <?php } elseif ( in_category( array( '2701', '2702' ) )) { ?>
    <h3><?php _e('Answers', 'genesis'); ?></h3>
    <?php } else { ?>
    <h3><?php _e('Comments', 'genesis'); ?></h3>
    <?php } ?>

    Thread Starter nemci7v

    (@nemci7v)

    Thank you! I tried that the first time but I think I added something wrong. The code you provided works! ??

    All i did was make a few corrections to your code, you’re welcome all the same…. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Comment heading in specific categories’ is closed to new replies.