Woocommerce – Default product image by user role

/** * Only allowing the customer and admin user role to view the product images * * @param $value * * @return bool */ function woocommerce_product_get_image_id_callback( $value ) { global $current_user; if ( in_array( ‘customer’, (array) $current_user->roles ) || in_array( ‘administrator’, (array) $current_user->roles ) ) { return $value; } else { return false; } } … Read more

Remove filter parameter from Link URL

You can set a canonical URL: <link rel=”canonical” href=”https://www.amaoni.de/shop/hundebetten” /> which will tell search engines that those pages are copies of each other (just with different filters). You can also tell Google, via Webmaster tools, which URL parameters to ignore (your filters). See this Help Centre article: https://support.google.com/webmasters/answer/6080548?hl=en

sessionStorage saves input value in browser but it is not loaded in the form field

You are using innerHTML for every field. Input field shouldn’t be using .innerHTML use .value instead and for select you should loop through the options not use .innerHTML window.onload = function() { var quote_price_input = sessionStorage.getItem(“quote_price_input”); var message_to_customer = sessionStorage.getItem(“message_to_customer”); var select_price_option = sessionStorage.getItem(“select_price_option”); if(quote_price_input !== null) { document.getElementById(‘quote_price_input’).value = quote_price_input; } else document.getElementById(‘quote_price_input’).value = … Read more

Only return taxonomies that are linked to a category & product

This will find all terms in custom taxonomy underkategorier and then will show terms with post from chosen category. $taxonomies = get_taxonomies(array(‘name’=>’underkategorier’),’object’); foreach($taxonomies as $taxonomy) { $terms = get_terms( $taxonomy->name, ‘orderby=count&hide_empty=0’ ); foreach($terms as $term) { $wpq = array (‘taxonomy’=>’underkategorier’,’term’=>$term->slug, “cat”=>10); $myquery = new WP_Query ($wpq); $article_count = $myquery->post_count; echo $term->name.’ ‘.$article_count; //with empty ones … Read more