That’s not how you chain multiple conditions with an if
statement. Try this
<ul>
<?php foreach ($categories as $category) { ?>
<?php if ($category->name !== 'Slides' && $category->name !== 'Uncategorized') { ?>
<li><?php echo $category->name; ?></li>
<?php } else { ?>
<li>Unknown</li>
<?php } ?>
<?php } ?>
</ul>
Related Posts:
- what is the action hook code to supporting product category condition in single product page of woocommerce?
- Add custom field to attachments in a specific category
- has_category() for parent category
- Conditional Tag for sub cagtegories?
- Attachment page per category
- How to run WP_Query to retrieve attachments to posts only from a particular category?
- Code to pull in a PHP file named after the category ID
- in_category() works in single.php but not in page.php?
- Add title, post content, and category like add_post_meta and update_post_meta
- functions.php conditional tag – only show in single.php?
- Show only one category
- Set the default category of an attachment
- Implementing a tricky wordpress menu (nested categories + thumbnails)
- Taxonomy filter all children
- Second level subcategory
- query in category.php repeats itself
- Link Attachment Image to Category
- Remove product category placeholder image (Woocomerce)
- Counter in loop in foreach
- How to limit number of attachments
- Woo Framework: woo_cat_featured not populating
- get_post_meta not working on category.php
- Create menu locations for each category in wordpress
- Different Output for “Every Other” Foreach Statement?
- Is there a reason I cannot get the current category in a loop?
- Echo text using is_tag
- Change categories count to include media attachments
- Exclude category from foreach loop
- Conditional category & tag statement
- Explode() expects a string
- Regarding Tags And Categories
- Sidebar by Category Conditional Statement not functioning
- Media Library Category Exclude Tree
- How get all media from a posts category by db?
- Cant get unique_array() work on get_the_category() foreach loop
- How to add Pagination to foreach loop to page
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- How can I modify this code to iterate over an array of categories?
- foreach,having wp_query inside, breaks after showing one result
- Category foreach Paging
- How can I hide the category term for posts with none set?
- Display only the latest post
- Paginating a list of all posts collected by category titles
- how to edit wp category widget
- Call Current Category
- Page permalink rewrite
- How to link images of one WP site to another WP site?
- Weird html output of single_cat_title – is not inside of the html element?
- Get posts from sites in Multisite?
- WordPress remove separator from last item in wp_list_categories
- Filter categories using tags
- Need help adding custom field to category
- How to display a list of categories
- Create single.php for specific category by category id
- is_category in pre_get_posts results in php notices
- Looking to exclude blog posts from category Previous/Next buttons
- How to make all posts in a category “unsticky”?
- How do I get the total number of categories in a list of search results?
- advanced custom field Show field in special categry page [closed]
- Creating archive pages for children categories
- Get Post Primary Category
- Arrange posts by date in front page
- “Categories” on my front page [closed]
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Add “page-a” slug to category link if user visit category link from “page-a”
- create a page which displays a list of categories title+ short description?
- select parent category first then child
- Scheduling update post daily
- How to exclude children categories of parent category
- Assign category from custom field on post creation and update
- get_template_part based upon post’s category
- Category template with pagination returns 404 on next pages
- Display custom taxonomy attached to the post on post single page
- How to display numbered pages in a category
- How can I add an “ALL CATEGORIES” entry in wp_dropdown_categories?
- Get and show all of the available categories
- how to remove the default title of Categories widget
- How to get posts by category at /%category%/ url?
- Custom row actions on a specific category
- Show multiple categories in query using redux framework variable
- Add multiple orderby with pre get posts
- new WP_Query issues
- Is custom menu name and category name linked in wordpress?
- I need to display posts in subcategory beside posts in main category
- How to remove an item from a custom Walker_Nav_Menu
- display number of posts by category Shortcode
- Custom permalink /%category%/%postname%/ produces 404 on each post
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- Getting a sub category based on a category name
- I have many different products on my website how can I get them to display under specific categories?
- Help with SQL query, how to add taxonomie terms with value stored in options?
- Pass list of categories to JS
- WP url to get rss with full text of post
- Display Referring Category on single post?
- conditional tags for the output of a plugin
- How to echo a different field if another field is empty?
- Remove the_content From Loop
- Display deepest post category, when post have multiple categories
- Woocommerce Force the category choice before creating new product? [duplicate]