WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add text before body based off of certain categories (5 posts)

  1. Steve519
    Member
    Posted 4 years ago #

    I run http://www.platformnation.com, 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!

    Thanks!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    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).

  3. Steve519
    Member
    Posted 4 years ago #

    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.

  4. Steve519
    Member
    Posted 4 years ago #

    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?

  5. Steve519
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic