Home › Forums › Pro Support › Woocommerce category or tag as parameter
Tagged: Category, Tag, woocommerce
- This topic has 7 replies, 2 voices, and was last updated 2 years, 3 months ago by
elvin.
-
AuthorPosts
-
June 2, 2021 at 12:42 am #30831
luisa
ParticipantMaybe there is thread yet, but I don’t know how to find it.
Can I give the category or tag as parameter to wpsp_display ()? It would be great if a woocommerce customer clicks on a term of this kind to find the corresponding items.
Thanks in advance!June 3, 2021 at 12:28 am #30869elvin
ModeratorHi Luisa,
Can I give the category or tag as parameter to wpsp_display ()?
Sure you can. It’s basically writing a query args array like the ones you see here – https://developer.wordpress.org/reference/classes/wp_query/
Example:
$settings = array( 'post_type' => 'product', 'taxonomy' => 'product_cat or product_tag', 'tax_term' => 'category slug or tag slug here', ); wpsp_display( 1699, $settings );
Where
1699
is the WPSP id.It would be great if a woocommerce customer clicks on a term of this kind to find the corresponding items.
The post meta that displays links to the corresponding category archive of the product. In a sense, doesn’t the category archive of a product serve as a list of “corresponding items”? 🙂
June 3, 2021 at 2:18 am #30877luisa
ParticipantThank you very much! I’m not a skilled PHP developer and I needed the right hint 🙂
Indeed, on the WooCommerce product page you can click on categories and tags, but I would like to show them with WPSP instead, as I have more control on displaying things.June 3, 2021 at 11:15 pm #30893elvin
ModeratorThank you very much! I’m not a skilled PHP developer and I needed the right hint 🙂
Indeed, on the WooCommerce product page you can click on categories and tags, but I would like to show them with WPSP instead, as I have more control on displaying things.In that case you may have to do a redirection to your page with WPSP listsing(which will effectively make the default product cat archive page useless) or hook in your own custom “meta links” as no WP core function would be aware which page serves WPSP listings of “corresponding items”.
June 4, 2021 at 12:21 am #30898luisa
ParticipantIn that case you may have to do a redirection to your page with WPSP listsing(which will effectively make the default product cat archive page useless) or hook in your own custom “meta links” as no WP core function would be aware which page serves WPSP listings of “corresponding items”.
yes, you hit the target. I don’t know if I’m able to do it, but I’ll give a try. Thanks for helping.
June 6, 2021 at 5:05 pm #30981elvin
ModeratorThere are redirection plugins you can use. I believe this won’t need coding.
If you’re using Yoast or Rankmath for SEO, it actually comes with a redirection feature. You can use that. 🙂
June 6, 2021 at 9:45 pm #31003luisa
ParticipantI have Yoast, I’ll check ! Thanks a lot, very helpful 🙂
June 6, 2021 at 9:54 pm #31006elvin
ModeratorNo problem. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.