Woocommerce image variation not changing

I have Design and size variations of a product and have uploaded the various images accordingly. On the front end, the images are swapping when the user selects different Design and size. The problem regarding the Design and Size changes. image changing will only work if the user selects a size before selects the Design. Is there a way that the Design selecting will work without choosing a Size first? Thanks Source: https://wordpress.stackexchange.com/feeds

Color swatches on category page?

I’m trying to add color swatches on category page. I have this code in functions.php : add_action( ‘woocommerce_after_shop_loop_item’, ‘sm_display_product_color_options’, 9 ); function sm_display_product_color_options(){ global $woocommerce, $product; $variation_colors_data = $product->get_attributes(); $variation_colors_data = $variation_colors_data[‘pa_color’]; $variation_colors = $variation_colors_data[‘options’]; echo « <div class=’product_colors_container’> »; foreach ($variation_colors as $variation_color) { echo « <div class=’variable-item-span variable-item-span-color’ style=’background-color: ».get_term_meta($variation_color,’color’,true). »‘></div> »; } echo « </div> »; } and this is the output: <div class= »product_colors_container »><div class= »variable-item-span variable-item-span-color » style= »background-color: »></div><div class= »variable-item-span variable-item-span-color » style= »background-color: »></div></div> Any idea what’s wrong? Thanks. Andrei Source: https://wordpress.stackexchange.com/feeds

Is ‘no_found_rows’ a silver bullet for WP_Query optimization when getting all posts of a certain type?

I’m running a query (200-300 posts), while this might not be for a lot of people / hosts, I just want to optimize wherever I can, given the fact that a lot of things happen when running that particular script, and so, my motivation is optimization. My query is exactly: $args = [ ‘post_type’ => ‘post’, ‘orderby’ => ‘ASC’, ‘post__in’ => $post_ids ]; $headers = new WP_Query( $args ); So I’m asking the database to just give me everything that matches these IDs. But I don’t need any meta information,…

Web Design Weekly #333

Headlines The 9am Rush Hour Do you feel overwhelmed at the vast array of approaches and tooling? Struggle with performance? Fight almost daily to create compelling apps & sites that work across devices and browsers? If so, you’ll probably enjoy this. (medium.com) Responsive Images An excerpt from his new book, Image Performance, Mat Marquis shines a light on one of the biggest challenges for website performance. (alistapart.com) Things To Consider When Evaluating A JavaScript Library (freecodecamp.org) Articles Idle Until Urgent Philip Walton shares a strategy he has dubbed “Idle Until…

Iframe disappears when author updates page

If a user has an author role and is listed as the author of a page, when they make changes to the page and click update, the changes are made but the iframe that was in the wysiwyg disappears and no longer shows on the back-end or front-end. If an administrator or editor makes the changes and saves it, the iframe stays. Besides changing the user role to editor, how do I prevent the iframe from disappearing? I tried having the author paste the iframe code into the text view…

How to echo a PHP code into WooCommerce variation product?

I have a little complex to explain the problem which I hope someone can understand and help me with. I have set custom fields on WooCommerce which I use to enter a specific code for each product (something like SKU called « asin »), Then i use that code on my backend using Amazon API to get the price from the product page on Amazon (don’t worry my question is general and not related to API). Here is a sample of my code for the simple product type which works perfectly like…

Current page id returns the incorrect value

I need to capture the current page id, execute some conditional script in footer, in my own plugin function hooks to wp_footer. Here is my plugin code, but page id returning wrong value? <?php /* Plugin Name: My Plugin Author: GS Version: 1.1 */ Function footer_page_id() { global $post; echo ‘<div> page_id:’.$post->ID.'</div>’;// output wrong value global $wp_query; echo ‘page_id:’.get_the_ID();// output wrong value echo ‘post_id:’.$wp_query->post->ID; // output wrong value echo ‘page_id:’.$wp_query->get_queried_object_id(); // output always 0 echo'</br>’;exit; } add_action(‘wp_footer’, ‘ footer_page_id ‘); ?> Thanks in advance. Source: https://wordpress.stackexchange.com/feeds

How to change form action of wp-login page with a function

I’m manually creating my own WordPress login form. The action parameter of all the forms points to wp-login.php. I want to change it for all of them to custom url (/login). Any idea how to that? For example: <form name= »lostpasswordform » id= »lostpasswordform » action= »http://mywebsite.com/wp-login.php?action=lostpassword » method= »post »> So I want to change the form action into mywebsite.com/login/?action=lostpassword Note, I need for both Login, Register and Lost Password. Kind regards. Source: https://wordpress.stackexchange.com/feeds

Removing CPT slug from URL results in 404 error for archive page

I have created a CPT with rewrite rules as follows: « rewrite » => array( « slug » => « / », « with_front » => false ), In the functions.php, I have added the following code: function sh_parse_request_tricksy( $query ) { // Only noop the main query if ( ! $query->is_main_query() ) return; // Only noop our very specific rewrite rule match if ( 2 != count( $query->query ) || ! isset( $query->query[‘page’] ) ) return; // ‘name’ will be set if post permalinks are just post_name, otherwise the page rule will match if ( ! empty(…