I’m not sure if you can add styles in filters.
I tested the below code in wp_head action and worked perfectly:
function show_outlet_msg(){
$term = get_term( 40, 'product_cat' );
$total_products=$term->count;
if ($total_products>0){
$html="<style> #txt_outlet_zero{ display: none; } </style>";
} else {
$html="<style> #txt_outlet_head{ display: none; } </style>";
}
echo $html;
}
add_action('wp_head','show_outlet_msg');
Related Posts:
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- CSS change in woo commerce Place Order Text [closed]
- PHP function for horizontal Woocommerce thumbnails and badges
- How to hide a div section when user is logged in, in single product woocommerce
- Add Shortcode to ::before class
- Hot to edit WooCOmmerce dashboard?
- Display specific main Sub Nav on Woocommerce product pages
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- How to remove image on single product and get product to span page?
- How to add margin underneath woocommerce total price amount -> productpages
- How to create a container in php then customise it in CSS
- WooCommerce Checkout Cart [closed]
- How to check if a plugin (WooCommerce) is active?
- How to get Woocommerce order product info
- How to automatically apply woocommerce product title to all product images alt tags?
- WordPress Shortcode and Dynamic CSS
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- Woocommerce auto cancel On-Hold after X days
- WP_Query | Help me create a search term with an ‘OR’ relation?
- WooCommerce – Customer Order History Pagination
- The values of custom fields are not available functions.php
- Use wc_enqueue_js only on specific pages – nested add_action
- WordPress loop specific thumbnail size
- Use is_product_category() properly
- Changing Woocommerce flat rate every nth number of items
- How to select WooCommerce products by post_meta and order them
- An unwanted inline style is added to my body tag
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- write custom woocommerce templates and forms
- How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts
- WooCommerce – Email admin with new user details
- Selectbox in admin panel function linking to CSS
- Using if/else statements with output from theme options
- Issue adding sub category programmatically
- Which field should I edit to make the checkbox marked by default?
- How to display pictures from database?
- custom css for admin only
- responsive.css in the WordPress should be prioritized
- WordPress style.css not updating, only after theme reload
- Adding logo to WordPress header
- Thumbnails appear to be zoomed
- Odd / Even posts add class minus first post
- Add post with approval by the admin
- WordPress archive page showing 404 Error [duplicate]
- Woocommerce display one random product via php
- Removing WordPress Footer -without access to PHP code?
- Change product_base programmatically
- customize woocommerce templates and display store on home
- WC_Customer delete function returns error
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- Post repeated when opening in overlay, how do I solve this? [closed]
- Woocommerce: remove total sum from new order’s email [closed]
- Split site title and apply different classes
- Alter Woocommerce product archive structure
- custom post type with role Vendor
- WooCommerce: Display product categories to make IF statement
- Dynamic CSS through PHP issue
- Create Columns with Custom Walker and CSS Classes
- Replace category title with category description in woocommerce
- Add Custom Category Description When Empty
- I am having issue in divi woocomerce checkout module. (DIVI theme)
- Why would the child theme load in the Customize preview, but not on the site itself?
- Woocommerce display orders with products from specific categories to specific admins
- echo cutom css code to WordPress page template file ? is this safe?
- Display div if category has a specific parent
- global $product is empty string when passed into function
- I can’t go to the page archive-{post_type}.php
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- How can I change the background color of divs dynamically (depending on an order-status in woocommerce)?
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Use Search Term in html link and redirect
- How to get content on a blank basket/cart page in a custom theme with woocommerce
- I cannot find the wordpress.scss file that my live site is pulling from
- WooCommerce REST API AJAX Auth – 401 response
- Looping through and combining calls to Woocommerce REST API
- How to import woocommerce custom fields data into another site?
- Woocommerce – if selected attribute term equals
- split 1 cart item into instock and back ordered
- register dependency css and js inside a plugin class
- Adding a widget under an ‘Add to Cart’ button through a PHP snippet
- Woocommerce Related Product by 2 taxonomy
- custom field – changing an element or background of id div – different versions not working
- Hide price excluding tax when price is empty
- Woocommerce variable products are being added to the card on the homepage (ajax)
- user update profile for custom code
- Woocommerce variation with radio button + price
- Display text of price (minus 20%) on every product page in a sentence.
- Getting the date_diff function return the difference in days
- Show contact 7 form in popup
- Need some help with tweaking a code for woocommerce [closed]
- Converting Menu Links to List Elements
- How to get shared CSS body class between translated WPML pages [closed]
- FATAL ERROR , Sommerce Theme [closed]
- Woocommerce linking variations
- Header location [closed]
- Blog listing not showing dates for every post and arrow missing off image
- Custom field fetch error on woocommerce pdf invoice
- posts_clauses drop ACF get_field function
- hello can you advise how to fix the error?