wordpress

Using AJAX to load more products WooCommerce

拥有回忆 提交于 2021-02-20 00:42:49
问题 I am using AJAX to load more products on a WooCommerce archive. I have used AJAX to "Load More" once before on this page. I have used the same code for the most part, just altered the WP_Query arguments to suit my needs. I can't understand why my code doesn't work. JS /** * AJAX Load (Lazy Load) events */ $('#load-more').click( function(e){ e.preventDefault(); ajax_next_posts() $('body').addClass('ajaxLoading'); }); var ajaxLock = false; // ajaxLock is just a flag to prevent double clicks and

Wordpress Posts odd/even Li layout

你说的曾经没有我的故事 提交于 2021-02-19 23:51:27
问题 I am working on a custom theme and on one of the pages i need to style the posts pages as follows: http://gyazo.com/e1f7cfc03c7ba3981188077afcdf0314 The grey box is an image and the red box is content. I need to use perhaps an odd/even Li/Ul pseudo class/selector but i have no idea how to do it. Could anyone offer me a way to start it up? I was thinking of using the Odd/Even pseudo class on UL to change the divs names however i can't think how to do it or where to start. Thanks! Edit: I am

Wordpress Posts odd/even Li layout

瘦欲@ 提交于 2021-02-19 23:49:51
问题 I am working on a custom theme and on one of the pages i need to style the posts pages as follows: http://gyazo.com/e1f7cfc03c7ba3981188077afcdf0314 The grey box is an image and the red box is content. I need to use perhaps an odd/even Li/Ul pseudo class/selector but i have no idea how to do it. Could anyone offer me a way to start it up? I was thinking of using the Odd/Even pseudo class on UL to change the divs names however i can't think how to do it or where to start. Thanks! Edit: I am

NinjaForms Server Side Validation Frozen on “Processing”

情到浓时终转凉″ 提交于 2021-02-19 23:37:45
问题 I'm working with Ninja Forms on Wordpress 5.1.1 to submit a simple form. However, I need a simple server-side validation to take place. I've been sifting for days through documentation and the web, but I cannot find a solution to this issue. So far, I've been able to attach my function to the Ninja Form's ninja_forms_submit_data webhook. I've confirmed that the PHP is indeed being executed. However, when I submit the form, it is stuck on "Processing" when I try to return a custom error. I

NinjaForms Server Side Validation Frozen on “Processing”

久未见 提交于 2021-02-19 23:36:30
问题 I'm working with Ninja Forms on Wordpress 5.1.1 to submit a simple form. However, I need a simple server-side validation to take place. I've been sifting for days through documentation and the web, but I cannot find a solution to this issue. So far, I've been able to attach my function to the Ninja Form's ninja_forms_submit_data webhook. I've confirmed that the PHP is indeed being executed. However, when I submit the form, it is stuck on "Processing" when I try to return a custom error. I

NinjaForms Server Side Validation Frozen on “Processing”

有些话、适合烂在心里 提交于 2021-02-19 23:31:29
问题 I'm working with Ninja Forms on Wordpress 5.1.1 to submit a simple form. However, I need a simple server-side validation to take place. I've been sifting for days through documentation and the web, but I cannot find a solution to this issue. So far, I've been able to attach my function to the Ninja Form's ninja_forms_submit_data webhook. I've confirmed that the PHP is indeed being executed. However, when I submit the form, it is stuck on "Processing" when I try to return a custom error. I

NinjaForms Server Side Validation Frozen on “Processing”

[亡魂溺海] 提交于 2021-02-19 23:29:44
问题 I'm working with Ninja Forms on Wordpress 5.1.1 to submit a simple form. However, I need a simple server-side validation to take place. I've been sifting for days through documentation and the web, but I cannot find a solution to this issue. So far, I've been able to attach my function to the Ninja Form's ninja_forms_submit_data webhook. I've confirmed that the PHP is indeed being executed. However, when I submit the form, it is stuck on "Processing" when I try to return a custom error. I

NinjaForms Server Side Validation Frozen on “Processing”

主宰稳场 提交于 2021-02-19 23:26:24
问题 I'm working with Ninja Forms on Wordpress 5.1.1 to submit a simple form. However, I need a simple server-side validation to take place. I've been sifting for days through documentation and the web, but I cannot find a solution to this issue. So far, I've been able to attach my function to the Ninja Form's ninja_forms_submit_data webhook. I've confirmed that the PHP is indeed being executed. However, when I submit the form, it is stuck on "Processing" when I try to return a custom error. I

Add a purchase condition to WooCommerce products

◇◆丶佛笑我妖孽 提交于 2021-02-19 09:13:29
问题 I ma trying to add a purchase condition to my WooCommerce products with the following: {$current_user = wp_get_current_user(); if ( current_user_can('administrator') || wc_customer_bought_product($current_user->email, $current_user->ID, // return true return true;} But I don't know if this code is correct and an advise will be helpful. 回答1: The product Id argument is missing from wc_customer_bought_product() function, and you can get more easily the WP_User object. Here is a usage example:

How to disable fields that are pre-filled in WooCommerce checkout?

空扰寡人 提交于 2021-02-19 08:59:10
问题 I would like to prevent (make these fields readonly, for example) users from changing their billing information on the WooCommerce checkout form. I'm currently using this code snippet: add_filter('woocommerce_billing_fields', 'mycustom_woocommerce_billing_fields', 10, 1 ); function mycustom_woocommerce_billing_fields($fields) { $fields['billing_first_name']['custom_attributes'] = array('readonly'=>'readonly'); $fields['billing_last_name']['custom_attributes'] = array('readonly'=>'readonly');