How to hide the site text and just show a logo on AMP pages in WordPress?

Posted by Prem Tiwari | Updated on | WordPress


Want to hide the site text and just show a logo on AMP pages in WordPress? If you want to hide the site text and just show a logo, use the amp_post_template_css action. The following …

How to change the site icon on AMP pages in WordPress?

Posted by Prem Tiwari | Updated on | WordPress


If you want to change the site icon on AMP pages in WordPress? If you add a site icon, we will automatically replace the WordPress logo in the template. If you’d prefer to do it …

How to hide componentWillMount warnings in reactjs?

Posted by Prem Tiwari | Updated on | Reactjs


Want to hide componentWillMount warnings in reactjs? Use the following example code to hide componentWillMount warnings in your react application.

React Hooks and POST method

Posted by Prem Tiwari | Updated on | in ReactJS. Updated on


React Hooks and POST method. All you need is a handler that triggers post method. Now you can use this hook in your code and on any event handler just call callAPI returned from the …

How to decrease RSS cache time in WordPress plugin?

Posted by Prem Tiwari | Updated on | WordPress


If you want to decrease RSS cache time in WordPress plugin? It is better practice to change cache time for specific feed URL rather than globally: The default lifetime of a transient cached feed is …

WooCommerce custom jQuery event after added to cart

Posted by Prem Tiwari | Updated on | WooCommerce


WooCommerce custom jQuery event after added to cart. You need first to use jQuery instead of the alias $ and you should need to specify the “ready” state to allow the DOM to be completely …

How to remove category base from WordPress category URL?

Posted by Prem Tiwari | Updated on | WordPress


Want to remove category base from WordPress category URL? You can use http://wordpress.org/extend/plugins/wp-no-category-base/ plugin and it doesn’t alter permalink, so removing it reverts the structure with no problem. And you don’t have to alter core …

How to add CSRF to manually created form in wordPress?

Posted by Prem Tiwari | Updated on | WordPress


If you want to add CSRF to manually created form in wordPress? If you are using WordPress 2.0.4 or above you can use wp_nonce_field and wp_verify_nonce field to verify. The WordPress documentation has some examples …

How to Hide Payment Method in WooCommerce based on Postal Code?

Posted by Prem Tiwari | Updated on | WooCommerce


Want to Hide Payment Method in WooCommerce based on Postal Code? To disable/hidden “Cash on Delivery”, Place the below code in your theme’s function.php file.

How to replacing parent action of customiser theme?

Posted by Prem Tiwari | Updated on | WordPress


Want to replacing parent action of customiser theme? I think you’re making it way more complex, to modify the output of the tc_colophon_center_block() method, than it has to be. Just use the tc_credits_display filter:

How to add a promotional product when a certain cart amount is reached

Posted by Prem Tiwari | Updated on | WooCommerce


If you want to add a promotional product when a certain cart amount is reached? As you are targeting a certain cart amount to add a promotional product in the cart, you could use woocommerce_before_calculate_totals …

Find unique minimum and maximum dates from 4 tables

Posted by Prem Tiwari | Updated on | MySQL


Find unique minimum and maximum dates from 4 tables. You can always use a subquery in your FROM clause like below example:

How to preload network images using PageView in flutter?

Posted by Prem Tiwari | Updated on | Flutter


In this example, I will share how to preload network images using PageView in flutter I ended up using FutureBuilder and CachedNetworkImageProvider from the package cached_network_image to prefetch all the images. Here is my solution:

React Paginate Second Instance on same page does not re render

Posted by Prem Tiwari | Updated on | Reactjs


React Paginate Second Instance on same page does not re render. I’ve tested it locally with the plugin’s official demo. Here is the example code (focus on render and handlePageClick methods):

Problems trying to return api data without a class

Posted by Prem Tiwari | Updated on | Reactjs


Are you facing problem and trying to return api data without a class? Normally we would just load the data and then render our app. But React expects some initial state for all that data …