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

Trying to add Custom Post Type to this functions.php command

Both is check single post existing or not. But both function argument is different. is_singular(). Pass argument for this post type slug is_single() Pass argument for post ID, slug, title. If you are use is_single() then check post type name. Like: if ( is_single() && ‘conference_2021’ == get_post_type() ) { } Ref: https://developer.wordpress.org/reference/functions/is_singular/ https://developer.wordpress.org/reference/functions/is_single/

ACF checkbox return format based on page

You have to return the output with the value. you can check the following code. function hello_shortcode() { // Load field settings and values. $field = get_field_object(‘producent’); if( ! is_product_category() ) { $checkbox = $field[‘value’]; } else { $checkbox = $field[‘label’]; } $output=”‹p›”.$checkbox.’‹/p›’; return $output; } // register shortcode add_shortcode(‘hello’, ‘hello_shortcode’);

How to put variable in array, wp_insert_post?

You have to convert the $get_value variable in the simple array and then you have to convert in the associative array after that merge both array into one then you can create or update the post through the wp_insert_post() function. you can achieve this by the following code. if ($get_value) { // change the string … Read more

How to hide an option from dropdown in filter module

Nevermind. I applied this custom js to hide that specific taxonomy in the dropdown. <script> jQuery(function($){ var arr=[‘name-of-slug-to-hide’]; $(‘select[name=”wpv-category”] option’).each(function(){ if(jQuery.inArray($(this).val(), arr)>=0){ $(this).hide(); } }); }) </script>