Check if widget has content
Problem solved by this code below: <?php if (is_active_sidebar(‘extra_widget_1’)) { ?> <li> <?php dynamic_sidebar(‘extra_widget_1’); ?> </li> <?php } ?>
Problem solved by this code below: <?php if (is_active_sidebar(‘extra_widget_1’)) { ?> <li> <?php dynamic_sidebar(‘extra_widget_1’); ?> </li> <?php } ?>
I’m pretty sure that the problem is, that the WP_Query returns post objects, which are not identical to Woocommerces product objects. While you are trying to get the product data by getting the according global, that won’t work, especially because the query you are performing does nothing to that global. Now what I probably would … Read more
You cannot use wp_localize_script in page template. You have to use it in functions.php or your custom plugin, after you register your script, which is usually in the wp_enqueue_scripts action. https://codex.wordpress.org/Function_Reference/wp_localize_script
Put below codes in your functions.php function sorcey_customize_register($wp_customize){ $wp_customize->add_section(‘sorcey_footer’, array( ‘title’ => __(‘New Section’, ‘text_domain’), ‘description’ => ”, ‘priority’ => 120, )); /* ============================= Text input ===============================*/ $wp_customize->add_setting(“sr_copyright”, array( “default” => “”, ‘capability’ => ‘edit_theme_options’, “transport” => “postMessage”, )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, “sr_copyright_ctrl”, array( “label” => __(“Title”, “text_domain”), “section” => “sorcey_footer”, “settings” => “sr_copyright”, “type” => … Read more
This is expected, as it depends on the context. The raw content will show up for the edit but not the view or embed context. It’s filtered through the WP_REST_Controller::filter_response_by_context() method. You can always add a new field to the response with register_rest_field() where the get_callback callback receives an input array with post data, including … Read more
I got the solution so self-answering the question for future users/visitors. Hope it will help someone. I think this won’t be able to generate results based on the Post ID → the_post_thumbnail( ‘large’); However, this should work → <?php echo get_the_post_thumbnail($fpid, ‘large’); ?> (Above is succesfully tested) Other possibilities → <?php echo get_the_post_thumbnail($fpid, ‘thumbnail’); ?> … Read more
You’d be better off moving your function that updates the meta to a hook that runs on the front end and during AJAX calls. Then you don’t need to bother about checking if the request is an AJAX request or not. init is a good choice for this: function wpse_297026_update_user_activity() { update_user_meta( get_current_user_id(), ‘last_activity’, time() … Read more
It’s not so difficult. All you have to do is to add a condition and check if the book_id param is passed. You can even check if this param is correct (for example if the book_id should be a number, then you can check if it is): add_filter( ‘rest_gallery_query’, function( $args ) { if ( … Read more
It’s just a guess, since I haven’t tested your code, but… There is a part that looks pretty sketchy for me: All your actions are run only if this condition is true: if(isset($post_type) && $post_type == “listings”){ And where that $post_type variable comes from? $post_type = get_post_type(); So you don’t pass any post_id to that … Read more
After some hours of investigation I deactivated W3 Total Cache plugin. Still no changes. And then I noticed WP Redis plugin.. soo I searched for Redis Object Caching on serverside and found it. When I flushed the cache, the stock showed updated stock quantity. Soo.. always double-check your caching. 😀