WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to show a Message in posts that belongs to a single category or two? (2 posts)

  1. Abhik
    Member
    Posted 2 years ago #

    Hi,
    I want to show a message right after the post if that post belongs to a certain category (or categories).

    I know I need to put that within the loop, but what's the code?

    I tried,

    <?php
    if ( in_category( '11' )) {
     // My Message
    }
    ?>

    and

    <?php if ( in_category( array( '11', '12', '13') )) {
    	// My Message
    }
    ?>

    What am I doing wrong?

  2. Abhik
    Member
    Posted 2 years ago #

    Nevermind, I got it working.

Topic Closed

This topic has been closed to new replies.

About this Topic