Use CSS tag inside PHP code

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’);

Overriding inline !important CSS with Javscript code snippet with media query

why you prefer use javascript instead off css it self? javascript will overwrite the css rules if you put in wrong ways. please provide me the web inspect (if you use chrome or firefox). sometimes, css will not work if precedence not qualified reff: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity if you cant provide the web inspect, would you like … Read more