Pawan Kumawat

Upload Any File in My Account Registration Form

To allow users to upload a file in the My Account registration form in WooCommerce, you’ll need to customize the registration form and add a file upload field. We’ll use a custom function and a hook to achieve this. Here’s a step-by-step guide:

Calculate distance between 2 address using latitude and longitude

To calculate the distance between two locations using their latitude and longitude coordinates, you can use the Haversine formula. The Haversine formula is commonly used to calculate the great-circle distance between two points on the surface of a sphere (such as the Earth) given their latitude and longitude.

Disable Repeat Purchase Of Product

To disable repeat purchase of products in WooCommerce, you can implement a custom solution using a combination of code snippets and WooCommerce hooks. The idea is to prevent customers from adding the same product to the cart if it already exists in the cart. Below are the steps to achieve this:

Jquery Form Validator With User Name Exist User Email Exist

To implement jQuery Form Validator with the specified validation rules, including required, minlength, email, equalTo, custom validation, confirm password, username pattern, email existence in the database in WordPress, and username with no numeric value, you’ll need to combine client-side validation using jQuery Form Validator with server-side validation using PHP and WordPress functions.

Adding Sidebar In WordPress Theme

Adding a sidebar to a WordPress theme involves modifying the theme files and registering a new sidebar area using WordPress functions. Below are the general steps to add a sidebar in WordPress themes:

How To Create A Custom Product Tab On Product Page WooCommerce

To create a custom product tab on a WooCommerce product page, you’ll need to use some custom code. WooCommerce provides hooks and filters that allow you to extend and modify its functionality. Below are the steps to create a custom product tab in WooCommerce:

WordPress Ajax login

To implement Ajax login in WordPress, you can follow these steps: 1. Open the theme’s functions.php file in your WordPress theme directory. 2. Add the following code to the file:   // Enqueue jQuery and custom JavaScript function enqueue_custom_scripts() { wp_enqueue_script(‘jquery’); wp_enqueue_script(‘custom-scripts’, get_stylesheet_directory_uri() . ‘/js/custom-scripts.js’, array(‘jquery’), ‘1.0’, true); wp_localize_script(‘custom-scripts’, ‘ajax_login_object’, array( ‘ajax_url’ => admin_url(‘admin-ajax.php’), ‘redirect_url’ => home_url() )); } add_action(‘wp_enqueue_scripts’, ‘enqueue_custom_scripts’); // Ajax login function ajax_login() { check_ajax_referer(‘ajax-login-nonce’, ‘security’); $info = array(); $info[‘user_login’] = $_POST[‘username’]; $info[‘user_password’] = $_POST[‘password’]; $info[‘remember’] = true; $user_signin = wp_signon($info, false); if (is_wp_error($user_signin)) { echo json_encode(array(‘loggedin’ => false, ‘message’ => __(‘Wrong username or password.’, ‘text-domain’))); } else { echo json_encode(array(‘loggedin’ => true, ‘message’ => __(‘Login successful!’, ‘text-domain’))); } die(); } add_action(‘wp_ajax_ajax_login’, ‘ajax_login’); add_action(‘wp_ajax_nopriv_ajax_login’, ‘ajax_login’);   3. Create a new directory in your theme called “js” (if it doesn’t exist already) and create a new file called “custom-scripts.js” inside that directory. 4. Open the “custom-scripts.js” file and

How To Limit Search To Only Post Titles?

I added a text field to the posts filter form and I use s= parameter to make the search work. But how to search only in the title of the post (not in the content)? how to limit search to post titles? How to search only by Post Title?

Categories