Adding tawk.to code just before body tag on functions.php file

You can the code to head or before body tag this way. Add this code at the last of functions.php add_action( ‘wp_head’, function() { ?> <!–Start of Tawk.to Script–> <script type=”text/javascript”> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement(“script”),s0=document.getElementsByTagName(“script”)[0]; s1.async=true; s1.src=”https://embed.tawk.to/5b54359ee21878736ba23110/default”; s1.charset=”UTF-8″; s1.setAttribute(‘crossorigin’,’*’); s0.parentNode.insertBefore(s1,s0); })(); </script> <?php } ); Hope it helps

How to make custom total price reactive in navigation

Using woocommerce woocommerce_add_to_cart_fragments filter you can do that. Going by the id attribute that you currently have for the span that displays the cart total, you can use the following code add_filter(‘woocommerce_add_to_cart_fragments’, ‘bt_update_cart_total’); function bt_update_cart_total ($fragments) { $fragments[‘#order-total-price’] = ‘<span id=”order-total-price”>’ . WC()->cart->get_cart_subtotal() . ‘</span>’; return $fragments; } Add this code to your functions.php file … Read more

API response to be stored locally

Sure, you can store it in a transient for a day. <?php $list_items = get_transient( ‘my_list_items’ ); if ( false === $list_items ) { // Assume “$list_api->get_items()” connects to an API. $list_items = $list_api->get_items(); set_transient( ‘my_list_items’, $list_items, DAY_IN_SECONDS ); } if(!empty($list_items)) { foreach($list_items as $list_item) { ?> <div class=”item-container”> <h2><?php echo $list_item[‘title’]; ?></h2> <p><?php echo … Read more

Settings API – sanitize_callback is not called and it leads to an incorrect behavior

If I take the value sanitize_callback out of the argument array completely, everything works as desired, so error-free. Yes, and that’s because you used the wrong callable syntax which then causes PHP to use a global function named sanitize_options instead of the method/function of the same name in your class (i.e. Faqdesk_Settings::sanitize_options()). So to solve … Read more