custom-taxonomy

WooCommerce: Custom cart item counts by product category

ε祈祈猫儿з 提交于 2019-12-24 03:07:24
问题 I found this script that allows me to show cart content total above the shopping cart icon within WooCommerce: <a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a> If there are 100 items in my cart it shows 100. What I really want is to display

WordPress Custom Permalink Structure for: Pages, Posts and Custom Post Types

回眸只為那壹抹淺笑 提交于 2019-12-23 23:25:25
问题 I'm trying to set a custom permalink structure for a custom post type based on a custom parent/child taxonomy. I've managed to achieve the thing but I broke the permalink structure for pages and posts. I've accomplisged the following: mysite.com/taxonomy_parent/taxonomy_child/postname In other words, I've remove the taxonomy slug and the URL show the correct hierarchical order. First, I set the 'rewrite' arg when registering the custom taxonomy and the custom post-type: for the custom

Disable shopping when an item from a specific product category is in cart in Woocommerce

早过忘川 提交于 2019-12-23 04:26:24
问题 I am trying to Disable shopping if a an item from a specific product category is in cart (which is a subscription in form of product with tabs - checkout and shipping are stripped off). When that product is added to cart, no other products should be allowed to be add up. I have tried those threads code: Disable Woocommerce add to cart button if the product is already in cart Prevent checkout for cart with specific category But didn't helped. How can I disable shopping if a specific product

Product variation WP_Query with a product category in Woocommerce

試著忘記壹切 提交于 2019-12-22 18:28:42
问题 With Woocommerce, I am trying to make a WP_Query for product variations post type with a product category 'Apple'. $args = array( 'product_cat' => 'Apple', 'post_type' => array('product', 'product_variation'), 'post_status' => 'publish', 'key' => '_visibility', 'value' => 'visible', 'posts_per_page' => 100, 'taxonomy' => 'pa_size', 'meta_value' => '39', 'meta_query' => array( array( 'key' => '_stock', 'value' => 0, 'compare' => '>' ) ) ); But I can't get it work in this query. If I remove

Product variation WP_Query with a product category in Woocommerce

最后都变了- 提交于 2019-12-22 18:28:02
问题 With Woocommerce, I am trying to make a WP_Query for product variations post type with a product category 'Apple'. $args = array( 'product_cat' => 'Apple', 'post_type' => array('product', 'product_variation'), 'post_status' => 'publish', 'key' => '_visibility', 'value' => 'visible', 'posts_per_page' => 100, 'taxonomy' => 'pa_size', 'meta_value' => '39', 'meta_query' => array( array( 'key' => '_stock', 'value' => 0, 'compare' => '>' ) ) ); But I can't get it work in this query. If I remove

Auto add all product attributes when adding a new product in Woocommerce

Deadly 提交于 2019-12-22 08:27:05
问题 A client of mine requested this weird change based on Wordpress' plugin Woocommerce in order to make things "easier".. Is it somehow possible to have all product attributes automatically added when a product is created? Also is it possible to have the "Visible on product page" checkbox automatically disabled if there is no value inputted in the attribute? Any help will be very much appreciated. Edit (explanation): This is what was explained above : 回答1: Here is the way to auto add all

Using a custom single product template for a specific product category in Woocommerce

扶醉桌前 提交于 2019-12-21 19:44:58
问题 I'm trying to use a custom page for only one of the products in the woocommerce shop. I've been trying to apply the attached function but without success (which code is coming from this answer). I have a created a copy of the single-product.php file in my /woocommerce folder with some added code, but the single product view only shows the "standard" single-product-php and not my single-product-mock.php file. And the product does have the product category "custom". add_filter( 'template

Display current post custom taxonomy in WordPress

社会主义新天地 提交于 2019-12-20 09:45:24
问题 I've created custom taxonomies on WordPress and I want to display the current post taxonomies on the post in a list. I'm using the following code to display a custom taxonomy named "Job Discipline": <ul> <?php $args = array('taxonomy' => 'job_discipline'); ?> <?php $tax_menu_items = get_categories( $args ); foreach ( $tax_menu_items as $tax_menu_item ):?> <li> Job Discipline: <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>"> <?php echo $tax_menu_item->name; ?> <

Custom Post Type and Taxonomy pagination 404 error

我只是一个虾纸丫 提交于 2019-12-20 06:29:27
问题 Pagination is not working on taxonomy.php. Here is my code for register custom post type and taxonomy add_action('init', 'ep_add_equipment'); function ep_add_equipment() { $labels = array( 'name' => _x('Equipments', 'post type general name', 'epanel'), 'singular_name' => _x('Equipments', 'post type singular name', 'epanel'), 'add_new' => _x('Add New Equipment', 'slide', 'epanel'), 'add_new_item' => __('Add New Equipment', 'epanel'), 'edit_item' => __('Edit Equipment', 'epanel'), 'new_item' =>

Custom product price suffix for selected product categories in Woocommerce

泄露秘密 提交于 2019-12-20 03:01:32
问题 I would like to display a piece of text after the price tag in WooCommerce. I have a code that is working for my functions.php, but it shows on all product categories. I was wondering if someone knows how to make this custom text to show for only selected categories; or even better, unselected product categories as there are a lot more product categories that will display the text than the ones who doesn't. My actual code: add_filter( 'woocommerce_get_price_html', 'custom_price_message' );