WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Function Reference Help. (3 posts)

  1. jnegron101
    Member
    Posted 2 years ago #

    Hello all. Im working on this little reference code snippet,
    the code listed below kicks back a "yesha" if a post is in
    category 45 OR our town OR delete

    <?php
    if (in_category( array( 45, 'our-town', 'delete' ) )) {
     echo "yesha";
    } else {
    	echo "no";
    }.....

    Im looking for something that does this. >
    Echo "yeshsa" if post is in category 45 AND our town AND delete
    So it would be conditional if the post is in these multiple categories.

    Any help would be appreciated.
    J

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    have you tried some old fashioned logical operation such as:

    if ( in_category(45) && in_category('our-town') && in_category('delete') ) {
  3. jnegron101
    Member
    Posted 2 years ago #

    thanks Sir. perfect approach to it.

Topic Closed

This topic has been closed to new replies.

About this Topic