Support » Fixing WordPress » Add text before body based off of certain categories

  • Resolved Steve519


    I run, I’m looking for a way to edit our theme so it would show a disclaimer after the title but before the body for just certain categories that we have on our page.

    How would I go about doing this?

    Any help on this would be greatly appreciated!


Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator

    Try adding:

    <?php if( is_category( array( 'Foo', 'Bar', 'Test') ) ) :?>
    [ insert disclaimer text & markup here ]
    <?php endif;?>

    to your theme’s category.php file (or archive.php if you don’t have a category template file).

    not working. At least not the way I’m trying to get.

    I don’t have a category.php file in my template. And I’m trying to add the text after the title and before the body on the single.php or single page.php view.

    ok, figured it out, instead of is_category i needed in_category for my needs

    This worked for me:

    <?php if( in_category( array(‘275’, ‘22592’, ‘12869’, ‘23648’,’309′, ‘6658’, ‘310’) ) ) :?>
    <p>Disclaimer:text here.</p>
    <?php endif;?>

    Now is there a way I could put some sort of outline box around this?

    nevermind the outline box, I went about it a different way. Thanks esmi for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add text before body based off of certain categories’ is closed to new replies.