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?
- What is an equivalent of single_cat_title for getting the slug of the category?
- How can i insert term in a specific language of Polylang?
- How to make 2 tag feeds show up on 1 page?
- Class active for Archive link – looped out
- WordPress search only showing a few posts
- Issue adding sub category programmatically
- One Specific Category To Permalink
- WordPress category page redirects in .htaccess not working
- Solution for ascending order in a category
- Why do my categories redirect?
- Hide woocommerce category name from specific pages
- Hide woocommerce category name from specific pages
- need to add custom field in more products
- Taxonomy name repeating when showing 2 posts from each category
- Category being displayed without base parmalink
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- How to change category and year archive permalinks/rewrite rules?
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- select parent category first then child
- The Category page shows all the posts, without differentiating by categories
- How to redefine the sorting of product categories by menu_order?
- Scheduling update post daily
- List categories with posts
- How to exclude category ID from Looper in WordPress
- Retrieving category’s color with get_term_meta
- New Categories Not Shown In the Post Edit Page
- Add a specific part of current category page url to shortcode
- Filter Categories in meta box for CPTs
- Different templates for different category tags
- Pagination not visible on woocommerce’s category page
- Order of subcategories
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- how do I get a specific post from a post with a subcategory in WP
- Search in custom post type AND in pages with category
- How to change a post category when the ACF datepicker Field is today
- How can I add more “filters” to my products? (Categories, attributes, etc.)
- WP grandchild categories in nested ul li
- Removing post category base giving Error 404
- Grab posts by multiple categories
- Pass Category Name, Description and Photo into variables to pass to jQuery
- How to display singular form of category name?
- Categories showing page not found
- How to display post categories within the Latest Posts block?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- How to show single category archive
- Move category description below post list in blog
- Shortcodes not working in category or tag description
- How can I define a custom archive for childs of a specific category?
- Post publish directly in all categories except one need pending review
- Populate dropdown based on selection of parent category
- Display category posts before others category custom query [closed]
- Get Prevous/Next Post Specific Category Without Excludes