Amitpal Singh
Blog

Tutorials and code snippets

Fixes and how-tos for WordPress, WooCommerce, JavaScript, PHP and Cordova, written while building client projects.

WordPress

WordPress REST API Custom Endpoint with URL Parameter

First you need to pass in the namespace to register_rest_route Like this Your name space namespace/v1 and your route is /product/{id} like this…

WordPress

WordPress: How to get featured media url in rest api?

WP Rest API: details of latest post including featured media url in one request? WP Rest API – How to get featured image?

WordPress

WordPress: If no featured image is set, default.png is showing. How to remove default.png from rest api?

here’s the wp_get_attachment_image_scr function: as u can see if 3-rd param is true then it looks in icons dir for that image ( and i assume…

WordPress

Wordpress - Pass Query string as slash based URL

Are you trying to pass a parameter to a wordpress page. And don’t want to pass it as a query string. You would like to pass as a slash based url? Example:…

WooCommerce

Programmatically creating new order in Woocommerce

Programmatically creating new order in Woocommerce You can create this order while triggering a function, ajax or add_action in wordpress. Enjoy!

WooCommerce

How to change "pay for order" button text in woocommerce?

How to change "pay for order" button text in woocommerce?

WordPress

Wordpress meta query: Get lowest or highest number value?

Wordpress meta query: Get lowest or highest number value?

Web development

How to only display posts whose meta_value field is not empty?

If you want the meta value to exist and have some value other than an empty string:

Cordova

Cordova: Create .aab bundle file in cordova @android development

Google recommends using the new Android App Bundle format for apps uploaded to Google Play. When you upload an APK a warning is displayed which encourages…

WordPress

WordPress: How to get attachment file name by id?

How to get attachment file name by id? @wordpress

WordPress

WordPress: How to get attachment file size by id?

How to get attachment file size by id? @wordpress

WooCommerce

How do I add icons on the woocommerce tabs in the my account page?

To add custom HTML to the tab title you can create an array from your icons and change nvaigation.php in the woocommerce template folder like below: and…