you can use has_term to check if a post as a term which that is what “business directory categories” are (custom taxonomy terms).
something like:
if (has_term( $term, $taxonomy, $post_id )){
//do your thing
}
if you want to check if you are in a specific term ( like is_category
) you can use is_tax
if (is_tax( $taxonomy, $term )){
//do stuff
}
if you want to check if your object (post) is in a specific term ( like in_category
) you can use is_object_in_term()
if (is_object_in_term( $object_id, $taxonomy, $terms) ){
//do stuff
}
Related Posts:
- wp_enqueue_script adding conditional statement not working
- Check if first paragraph is an image, then show custom code right after it?
- If post author role is X
- Can a conditional statement apply to part of a slug?
- Add default content to posts in a specific category?
- is_front_page, is_page(‘slug’), is_page(id) not working
- Need help on creating If-statement for custom meta fields
- How to make gravatar.com avatars conditional?
- Loading Scripts on Specific Pages
- Condition function for is parent category?
- Conditional Statement – Best Way to Remove Nav on Contact Page
- Proper syntax for simple conditional bloginfo language
- wordpress is_page() problem
- Location-Based Content
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Personalized message for each unique password-protected page
- Conditional Shortcode image display
- Change Woocommerce order button page on particular page
- Change a url / link if a user is logged in?
- How to use “Cases” instead of “IFs” for conditional logic
- Which is the better way to write a conditional statement? [closed]
- Nested conditionals
- Is there a way to password-protect part of a post?
- if/Else have_posts Else fails to echo message to page
- Conditonal statement for iPad
- Return function only on certain pages
- How to write this conditional statement?
- Conditional for Custom Post Types
- Date-Based Conditional Tag
- Message box when accessed from iPad
- Show this code if user has previously left a comment
- Insert a conditional in the middle of a function to give it 2 different outcomes
- How can I use ‘edit_form_after_title’ conditionally?
- Force Log in to view a page
- Conditional loading of CSS for my plugin
- Looks like this if condition is not working [closed]
- Generating images from an array of categories
- WP conditional site logo and header block
- How to know if the most recent article
- Widget logic conditional widget
- How to display image on condition that a selection has been made
- How to Conditionally Not Display a Link Based on Current URL?
- Allow users to only CREATE one single (custom) post
- If statement to check for post_content
- why is my custom loop failing?
- Conditional sidebar menu
- What is the best way to disable my WP website if the user has adblocker on? [closed]
- How to tie two conditions to one statement
- Create a page from different content blocks
- Content Restriction but allow public REST API
- How to delete a file or folder in Python?
- How do I list all files of a directory?
- How can I safely create a nested directory in Python?
- Find the current directory and file’s directory [duplicate]
- What is the reason for the error message “System cannot find the path specified”?
- How do I list all files of a directory?
- How to find if directory exists in Python
- How do I find all files containing specific text on Linux?
- Importing modules from parent folder
- Importing modules from parent folder
- How can I safely create a nested directory in Python?
- PHP – Move a file into a different folder on the server
- How do I list all files of a directory?
- How to change permissions for a folder and its subfolders/files in one step
- How to rename a directory/folder on GitHub website?
- Download a single folder or directory from a GitHub repo
- Creating a new directory in C
- How to create a directory using Ansible
- How to change permissions for a folder and its subfolders/files in one step
- How can I get the source directory of a Bash script from within the script itself?
- In a Git repository, how to properly rename a directory?
- Compare 2 directories in windows
- How can I add a blank directory to a Git repository?
- How can I get the list of files in a directory using C or C++?
- How can I get the list of files in a directory using C or C++?
- How to create a directory in Java?
- What is the current directory in a batch file?
- Count how many files in directory PHP
- How do I get the full path of the current file’s directory?
- Portable way to check if directory exists [Windows/Linux, C]
- Creating files and directories via Python
- How to change current working directory using a batch file
- If a folder does not exist, create it
- Extract a part of the filepath (a directory) in Python
- Can’t remove a directory in Unix
- How can I find script’s directory?
- Command prompt won’t change directory to another drive
- Python copy files to a new directory and rename if file name already exists
- Create a folder if it doesn’t already exist
- cd into directory without having permission
- What is the difference between \ and \\ in file path
- How can I rename a project folder from within Visual Studio?
- Recommendations for an address book/directory plugin WordPress?
- how to get wp-content folder in wordpress?
- How do test if a post is a custom post type?
- Enqueue Scripts / Styles when shortcode is present
- Custom Post Type Templates from Plugin Folder?
- How to structure a plugin
- Add multiple plugin directories
- Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error