How can I hide if the category is "laundromat" here? <?php $storecategories =…
- User
How can I hide if the category is "laundromat" here?
code<?php $store_categories = get_the_terms(get_the_ID(), 'wpsl_store_category'); if ($store_categories && !is_wp_error($store_categories)) { ?> <p class="fw-600 mb-0 sd-text-secondary mt-3 fs-4 mb-1">Services</p> <div class="row row-cols-1 row-cols-lg-2 g-0 g-lg-1 fs-5 mb-4"> <?php foreach ($store_categories as $category) { $icon = get_field('sd_icon', 'wpsl_store_category_' . $category->term_id); ?> <div class="col"> <i class="<?php echo esc_attr($icon); ?> sd-text-primary" style="min-width: 20px"></i> <?php echo esc_html($category->name); ?> </div> <?php } ?> </div> <?php } ?> - Assistant
To hide the output when the category is "laundromat," you'll need to add a conditional check inside your
foreachloop to skip rendering that category. This can be done by checking the category name and using acontinuestatement if it matches "laundromat." Here's how you can do that:php - User
The problem is that the taxonomy is "wpsl_store_category" and the post type is "wpsl_stores"
- Assistant
Thank you for clarifying that the taxonomy is
wpsl_store_categoryand the post type is . However, the code provided still applies because it already works with the taxonomy and post type you've mentioned. The code remains the same; we are just fetching terms from the specified taxonomy and hiding the category if it matches "laundromat".