Woocommerce category show subcategories only/omit posts for specific category
Maybe you want to try adding products to subcategory, but not showing them on main categories. Then when user filters and goes to subc, you show products. Link
Maybe you want to try adding products to subcategory, but not showing them on main categories. Then when user filters and goes to subc, you show products. Link
First, be sure to set up a child theme – don’t edit the current theme unless it’s a completely custom one. Otherwise, whenever you update your theme, your changes will be lost. To do: Check what folder your current theme is in. As an example, say you’re using Twenty Nineteen – it’s in a twentynineteen … Read more
That title is coming from archive.php file of TwentySixteen theme. You can find a <header> code section in that file. What you can do, simply copy the archive.php file as category.php and then remove the following code section from category.php file: <header class=”page-header”> <?php the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ ); the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ ); ?> … Read more
You can try using csv product import plugins like https://wordpress.org/plugins/woocommerce-xml-csv-product-import/ . The best way is to write a custom script as per your requirements.
The solution to my problem was to use: has_term( ‘the-cat-I-want-to-display’, ‘product_cat’ ) || is_product_category( ‘the-cat-I-want-to-display’ ) This worked. Thanks everyone for your help!
If I understand correctly, it certainly is possible. I would start with the function that determines if current category has parent or not. function category_has_parent($catid){ $category = get_category($catid); if ($category->category_parent > 0){ return $category->category_parent; } return false; } In the PHP template that displays your FAQ I would check if current category has parent (if … Read more
The term you are looking for seems to be “Taxonomy”, category and post_tag are base taxonomies, but you can register more taxonomies, depending on the needs. Right now, you are in need of 2 taxonomies, “hero” and “franchise”, once registered, you can affect them to a range of post_type. I don’t know if your “movie” … Read more
You can use wp_get_post_terms() and in_array() to check if “investments” is in the term array or not: <?php $catquery = new WP_Query(array( ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ )); ?> <?php while($catquery->have_posts()) : $catquery->the_post(); ?> <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘large’ );?> <?php // Gather all the post terms for the post. $post_term_objects = wp_get_post_terms( … Read more
There are functions for retrieving a term/category link (i.e. URL to the term archive page) and in the case of the default category taxonomy, you can use get_category_link(): <a href=”https://wordpress.stackexchange.com/questions/361461/<?php echo esc_url( get_category_link( $category[0] ) ); ?>”><?php echo $category[0]->name; ?></a> For custom taxonomies, you’d use get_term_link().
This will check to see if there is a hierarchy and set all parent categories as checked. This function assumes that if there’s multiple categories already set, then don’t do the function, since the categories would be correct if multiples are set. function set_product_parent_categories( $post_id ) { $category = wp_get_post_terms( $post_id, ‘product_cat’ ); // If … Read more