- This topic has 9 replies, 4 voices, and was last updated 3 years, 8 months ago by Tom.
-
AuthorPosts
-
July 21, 2020 at 9:54 am #1371110tractor-1
Hi,
I need to move the Woocommerce archive/category/tag/search etc title and description to the left and thought it would be possible through a shortcode put in a widget in the left sidebar. Demo.
Also, I’d like it to come wrapped in an aside tag with an id and a class so I can style it.
Thank you
July 21, 2020 at 11:25 am #1371179LeoStaffCustomer SupportHi there,
This is something you will need to check with WooCommerce’ support.
Perhaps a post like this would help?
https://wordpress.org/support/topic/short-codes-for-category-display/July 21, 2020 at 12:17 pm #1371263tractor-1Okay, ignore Woocommerce, how to output the post category/tag/search results/archive title and description through a shortcode?
July 21, 2020 at 2:53 pm #1371414TomLead DeveloperLead DeveloperYou could try this:
add_shortcode( 'taxonomy_title_description', function() { ob_start(); generate_archive_title(); return ob_get_clean(); } );
July 22, 2020 at 4:08 am #1371936tractor-1Simple, clean and beautiful — and works like a charm for Woocommerce archives too.
Any way to filter out the prefixes “Category:” and “Tag:” from the title on the product category and tag pages?
Post category and tag archives don’t have these prefixes in the title already, which is awesome.
July 22, 2020 at 5:45 am #1372019DavidStaffCustomer SupportHi there,
try this:
add_shortcode( 'taxonomy_title_description' , 'db_woo_archive_entry_header' ); function db_woo_archive_entry_header() { ob_start(); if ( is_product_category() ) { add_filter( 'woocommerce_show_page_title', '__return_false' ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); $term_object = get_queried_object(); ?> <div class="woocommerce-category-description"> <div class="inside-article"> <h1 class="title"><?php echo $term_object->name; ?></h1> <div class="description"><?php echo $term_object->description; ?></div> </div> </div> <?php } return ob_get_clean(); }
Original topic it came from for reference:
https://generatepress.com/forums/topic/shop-description-to-match-blog-category-description/#post-634945You may want to modify the markup and remove the Description to suit.
July 22, 2020 at 10:12 am #1372471tractor-1The code seems to work except for the
add_filter( 'woocommerce_show_page_title', '__return_false' ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
part as both the title and the description are still showing in their original location in the entry content area too.
July 22, 2020 at 2:37 pm #1372704TomLead DeveloperLead DeveloperYou may need to put that in a different hook:
add_action( 'wp', function() { add_filter( 'woocommerce_show_page_title', '__return_false' ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); }, 100 );
July 22, 2020 at 3:03 pm #1372730tractor-1All set now, thank you GP support!
July 23, 2020 at 9:42 am #1373761TomLead DeveloperLead DeveloperGlad we could help! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.