wordpress

How to make ship to different address checked when using Free Shipping and Flat Rate?

本秂侑毒 提交于 2021-02-11 12:01:43
问题 how can I make "Ship to a different address" checked when Free shipping or Flat rate is selected and Unchecked if Local pickup is selected. All I can see is either all 3 shipping methods are checked by default or not. Any advice would be much appreciated. Give thanks 回答1: Here is the way to show / hide checkout shipping fields (auto checking / unchecking "ship to different address" checkbox, based on the chosen shipping method. It will automatically show the shipping fields when the chosen

How to show post categories in Wordpress?

纵然是瞬间 提交于 2021-02-11 09:59:23
问题 i'm making a theme in WP but i can't find a way to show the categories of a single post, i want to display the categories that have a single post not all categories, i was using... <?php $args = array ('hide_empty' => 0,'title_li' => false,'style' => 'none',);wp_list_categories($args);?> But this is showing all categories and i don't need this. I'm new in this and i'm gonna be happy if somebody can help me :D Before i forget, sorry if my english is bad. 回答1: You can get all categories for

How to show post categories in Wordpress?

依然范特西╮ 提交于 2021-02-11 09:59:13
问题 i'm making a theme in WP but i can't find a way to show the categories of a single post, i want to display the categories that have a single post not all categories, i was using... <?php $args = array ('hide_empty' => 0,'title_li' => false,'style' => 'none',);wp_list_categories($args);?> But this is showing all categories and i don't need this. I'm new in this and i'm gonna be happy if somebody can help me :D Before i forget, sorry if my english is bad. 回答1: You can get all categories for

I want to upload file to specific folder with google drive API curl

青春壹個敷衍的年華 提交于 2021-02-11 07:21:41
问题 I have uploaded file to google drive with curl API. But I want to upload file to specific folder. I have also tried with folder id in API url like: https://www.googleapis.com/upload/drive/v3/files/folder_id?uploadType=media add_action('wpcf7_before_send_mail', 'save_application_form'); function save_application_form($WPCF7_ContactForm) { $wpcf7 = WPCF7_ContactForm :: get_current(); $submission = WPCF7_Submission :: get_instance(); if ($WPCF7_ContactForm->id == 8578) { if ($submission) {

Update WooCommerce product price and stock

和自甴很熟 提交于 2021-02-11 06:09:45
问题 I have external REST API, from which I'm building an array like this: $arr = array( 1 => array('code' => '0100686', 'qty' => '2', 'price' => '65.22'), 2 => array('code' => '0100687', 'qty' => '1', 'price' => '5.23'), 3 => array('code' => '0100688', 'qty' => '8', 'price' => '0.28') ); After this, I need to update the price and qty of products in WooCommerce. (In above array code is SKU in WC). Afterwards my code goes following way: foreach ($arr as $single) { $product_id = wc_get_product_id_by

Update WooCommerce product price and stock

人走茶凉 提交于 2021-02-11 06:08:53
问题 I have external REST API, from which I'm building an array like this: $arr = array( 1 => array('code' => '0100686', 'qty' => '2', 'price' => '65.22'), 2 => array('code' => '0100687', 'qty' => '1', 'price' => '5.23'), 3 => array('code' => '0100688', 'qty' => '8', 'price' => '0.28') ); After this, I need to update the price and qty of products in WooCommerce. (In above array code is SKU in WC). Afterwards my code goes following way: foreach ($arr as $single) { $product_id = wc_get_product_id_by

Woocommerce - Sort products in cart by Author/User in Multi-vendor setup

♀尐吖头ヾ 提交于 2021-02-11 05:53:17
问题 I have a multivendor Woocommerce shop using Dokan plugin and I'm trying to split out the shopping cart into sections based on who the vendor is. For example: Vendor 1 Product C Product B Vendor 2 Product A Dokan uses a custom role 'vendor' to extend the user class, so to get the ID of the vendors, I should be able to use something like: $post_data = get_post( $cart_item['product_id'] ); $vendor_id = $post_data->post_author; This does work, but it will only get the first vendor ID and simply

Add a custom class to variation options displaying “Out Of Stock” in Woocommerce

守給你的承諾、 提交于 2021-02-11 04:54:10
问题 I'm using "How to add variation stock status to Woocommerce product variation dropdown" answer code to show the text "In Stock" or "Out of stock" according to the stock status of the variation. This is what I get: I need to add a custom class only to these variants that showing text "Out of Stock". how can I do it? Emanuele 回答1: The following code will add the class outofstock to <option> html tag when the variation is "Out of Stock": // Function that will check the stock status and display

Get current user id inside shortcode return ever 0

半城伤御伤魂 提交于 2021-02-11 03:44:05
问题 I'm trying to customize a shortcode put inside a custom plugin, but I can't get the user id, it always returns me 0. It might also be okay to understand the role with current_user_can, but any information is always empty. Here the code: add_action( 'plugins_loaded', 'check_current_user' ); function check_current_user() { // Your CODE with user data global $current_user; $current_user = wp_get_current_user(); return $current_user->ID; } function appp_hide_content_shortcode( $atts, $content = '

Get current user id inside shortcode return ever 0

假如想象 提交于 2021-02-11 03:41:36
问题 I'm trying to customize a shortcode put inside a custom plugin, but I can't get the user id, it always returns me 0. It might also be okay to understand the role with current_user_can, but any information is always empty. Here the code: add_action( 'plugins_loaded', 'check_current_user' ); function check_current_user() { // Your CODE with user data global $current_user; $current_user = wp_get_current_user(); return $current_user->ID; } function appp_hide_content_shortcode( $atts, $content = '