Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've got a custom post type called Products, which underneath i've got a related products section using a plugin called http://wordpress.org/extend/plugins/related-posts-thumbnails/.

I need to be able to create some more post types for example called Accessories and Supplies. I need to be able to relate some accessories to products. How can i make it so when i add an accessory or supply i can say this relates to a certain product and shows in the related products section.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

2 possible solutions spring to mind, both fairly straightforward:

  1. Use a custom taxonomy to create groups then add the accessories and main product to the same group
  2. Add an interface that updates the post_parent field to mark items as accessories for a specific product

With either of these approaches you get a fairly easy way to group the products together although the taxonomy approach allows for more flexibility if there are accessories that could be used for multiple products.

share|improve this answer
    
I think custom taxonomy is probably the best way as the plugin for the relates posts uses categories and/or taxonomy. However it needs to be easy for the person i'm making it for. They don't want to have to create a taxonomy every time they add something new. They just want to be able to say, this accessory relates to this product. Is it possible to set it up to work like this? –  Corbula Nov 1 '11 at 14:49
    
If you only need to map an accessory to one product I'd go for the 2nd option. If so I can give you some example code. There's more involved if you go the taxonomy route. That said with a taxonomy you can automatically create the term for each product when the product is created. –  sanchothefat Nov 1 '11 at 16:23
    
I need to be able to relate an accessory or supply to multiple products. How can i do this using taxonomy? –  Corbula Nov 1 '11 at 21:26
    
Have you used custom taxonomies before? –  sanchothefat Nov 2 '11 at 9:45
    
No i haven't. When you say you can automatically create the term, is that something custom taxonomies will do already or do i haven't to do something extra to make it do that? –  Corbula Nov 2 '11 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.