- This topic has 6 replies, 2 voices, and was last updated 2 years, 11 months ago by
retroreiz.
-
AuthorPosts
-
February 3, 2020 at 11:04 pm #1153640
retroreiz
Hello everybody,
how can I display the description of the attributes on the attribute page below products?
Example: https://ibb.co/R4cRzgw
Thank you in advance.
Greetings, Andreas
February 4, 2020 at 7:10 am #1154251David
StaffCustomer SupportHi there,
try this PHP snippet to move the Description on the Product Archives:
add_action('woocommerce_archive_description', 'custom_archive_description', 2 ); function custom_archive_description(){ if( is_product_category() ) : remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5 ); endif; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 4, 2020 at 11:54 pm #1154948retroreiz
Hi David,
many thanks for the answer.
Unfortunately, this snippet only works on category descriptions. This snippet does not apply to attributes descriptions.
What should the code be for the attributes archive page to work?
Thanks and have a nice day.
Greetings, Andreas
February 5, 2020 at 3:21 am #1155130David
StaffCustomer SupportDo you need to move the description on all archives? so Category, Tags, Attributes etc
Let me knowDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 5, 2020 at 11:37 pm #1156221retroreiz
Hello David,
only attributes.
But if there is no other way, then also in categories, tags, attributes etc.
Thank you.
Greetings, Andreas
February 6, 2020 at 2:57 am #1156354David
StaffCustomer SupportSo i found this function:
function my_is_wc_attribute() { /** * Attributes are proper taxonomies, therefore first thing is * to check if we are on a taxonomy page using the is_tax(). * Also, a further check if the taxonomy_is_product_attribute * function exists is necessary, in order to ensure that this * function does not produce fatal errors when the WooCommerce * is not activated */ if ( is_tax() && function_exists( 'taxonomy_is_product_attribute') ) { // now we know for sure that the queried object is a taxonomy $tax_obj = get_queried_object(); return taxonomy_is_product_attribute( $tax_obj->taxonomy ); } return false; }
Original source: https://wordpress.stackexchange.com/a/333460
With that function added you should be able to do this:
add_action('woocommerce_archive_description', 'custom_archive_description', 2 ); function custom_archive_description(){ if( my_is_wc_attribute() ) : remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5 ); endif; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 6, 2020 at 8:38 am #1156832retroreiz
Hello David,
you are great!!!!
It works wonderfully 🙂
Thank you very much.
Greetings, Andreas
-
AuthorPosts
- You must be logged in to reply to this topic.