Editing function coding from viewing titles to viewing categories
-
Hello. I currently have a woocommerce shop set up and I have this shortcode which shows all documentation for my products: [woocommerce_product_documents_list] . and right now it lists the products by there names but I want to make it so that it lists the products by their category.
I was told to change this bit of code: $title = get_the_title( $post->ID ); and set the title to post’s category.
Does anyone know what that code would look like? I’m not familiar with functions but would it be something like this – $categories = get_the_terms( $id, ‘category’ );
I dont want it to show the name of the products at all just their categories.
This is the bit of code I think I have to edit if this helps:
// Get the product
$product = wc_get_product( $post->ID );// Get the title
$title = get_the_title( $post->ID );// Render any product documents
woocommerce_product_documents_template( $product, $title );Thanks
- The topic ‘Editing function coding from viewing titles to viewing categories’ is closed to new replies.