It looks like you just have an operator precedence issue.
Your logic here will always return true if $stat == ‘Sold Stat’ regardless of the result of in_category(‘secret-category’).
Try this, the extra parenthesis will force the || statement to be evaluated separately:
if (in_category('secret-category') && ($stat == 'NFS Stat' || $stat == 'Sold Stat')) {
echo 'Do something here.';
}
Related Posts:
- Customize rel=canonical tag for single blog post
- Post meta not working
- How to add category to: ‘wp-admin/post-new.php’?
- Setting Custom Sort Order of Posts within a Category
- Add a checkbox to post screen that adds a class to the title
- Convert custom fields to post categories
- Update all posts automatically when using post_meta
- How to change the layout and styling of posts according to their category in WordPress?
- Prevent duplicate posts in wp_insert_post using custom fields
- Better post meta efficiency?
- Add default content to post (for specific category)
- Add custom field to all posts in specific category
- Show One Category on Post
- Add custom field to category of custom post type
- Change post format using custom field
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Do I use custom post type or something else?
- Add custom fields to post programmatically
- Custom Theme Want To Remove One Category From All Displays
- What Is meta_id In wp_postmeta?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Edit custom post type admin menu link
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- How can I sort posts by the date and a custom meta field?
- How can i limit the number of posts created per category?
- WordPress custom Query for Posts in Category display posts multiple times
- Categories list into registration form
- Getting value from get_post_custom
- Add a custom meta box in the post options that loads some html code in the header
- Calling Different Custom Post Timestamps in a table
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set Default Category to Username
- Cannot retrieve a custom RSS field from posts
- Redirect to another page using contact form 7? [closed]
- How to I retrieve the ID from the Posts page?
- Edit multiple custom post types while saving a new or edited post
- Display post number by category
- Saving Post Data in Another Database
- How to call posts under a specific category on static front page?
- Add multiple meta keys to a post at once
- Static pages not working
- saving/reading custom field value does not work – no value gets POSTed
- Simple Custom Metabox Not Saving
- How to display only one category in a custom post type?
- Get post category as a separate string and url
- Can I style single post that are in multiple catergories?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- How to bulk Update URLs to new values?
- Adding an option to post editor to show a site disclaimer or message
- Is there a way to save different data when USER interacts with the same POST?
- How do you update post date (year only) in a separate custom field?
- Re-order Category Meta-data
- Custom post styling per category?
- WP_Query sort by meta_value_num or date
- Show custom post category for single post
- Add Categories To Custom Post
- Creating Ordered Query using Meta_key
- Static text above category page
- Order posts by separate menu order for different sub-categories
- How to only allow post to be deleted if custom field doesn’t exist
- Show a Category Specific Info Box
- Delete old post with new post
- Add default content to post (for specific category)
- Display ONLY Latest Post From Several Categories
- First Custom Post Custom Fields Empty After New Custom Post
- How to Do Custom Fields to Output a Definition List
- How enter custom post meta or custom field on box post list archive page?
- Taxonomy Category category.php not working
- Post’s arent displaying
- Only show posts belonging to multiple cateogries at same time
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- I have a website issue I am trying to resolve
- How to get the number of posts in a selected category?
- Attach pdf file to custom post type
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Remove custom posts that match taxonomy value
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Post Type Label Name
- wp_query ‘s’ parameter does not work with custom post type
- How to set up multiple taxonomies for groups of posts
- Blog Posts in Custom Menu
- Duplicate posts and change category
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- Custom Posts Query and meta_query Sort Order
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- How to get post with associated categories and tags names instead of ids with rest api?
- Updating post meta for checkbox
- l accidentally permanently deleted a Draft. There’s any way I can recover it?
- Getting post and attached image from subdomain
- How to list post as buch of category, and all of them
- Remove subcategory slug from url
- Is there a way to categorize a list posts all at once?
- On the online version of my blog posts disappear
- Multiple posts in one page
- delete post hook not being fired when deling in wordpress dashboard admin
- alt of attached image in post / pages
- Hook To Get All Posts Deleted
- How can I create a menu items from meta box based on users input
- WordPress strips some attributes for author posts
- How can I get on the same row two post of different categories?