Forums

[resolved] Function Reference Help. (3 posts)

  1. jnegron101
    Member
    Posted 3 months 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
    The Sweeper
    Posted 3 months 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 3 months ago #

    thanks Sir. perfect approach to it.

Reply

You must log in to post.

About this Topic