Add post to parent category automatically

272 views
Skip to first unread message

suefernandes

unread,
Dec 15, 2016, 5:02:08 PM12/15/16
to Manchester WordPress User Group
Hi All,

I have a client site where a listing post is added to the site and it's category is selected from a dropdown by the user.  The dropdown is part of a CRED form which in turn creates a listing post with a taxonomy of listing-categories.  

The custom taxonomy has a range of parent categories with sub-categories which show in the form and the user can select any one of these.  It all works fine, but the client is now asking if the listing can be automatically added to the parent category when the user picks one of the sub-categories from the list - essentially putting the post in both the parent and sub-category automatically even though only the sub-category is selected.

Does anyone know of any plugins or code that could achieve this?

Thanks

Sue 

Tom J. Nowell

unread,
Dec 15, 2016, 9:30:10 PM12/15/16
to Manchester WordPress User Group
Hey!

This already happens, a category includes all its sub categories, and the posts they include. E.g. if we label a product as 'brilliant red' or 'blood red' we would expect it to show up in the parent category 'red'.

This is the normal behaviour in standard post and taxonomy archives, but the CRED form code being used may not behave this way, I'd need to look at the code to determine this. It may be that it's deliberately changing this behaviour as it can sometimes confuse people whose mental model doesn't match ( literal parents and children, rather than nested groups/buckets )

--
See the group blog at https://mwug.uk
 
You received this message because you are subscribed to the Google
Group "Manchester WordPress User Group".
 
To post to this group, send email to
manchester-word...@googlegroups.com
 
For more options, visit this group at
http://groups.google.com/group/manchester-wordpress-user-group
---
You received this message because you are subscribed to the Google Groups "Manchester WordPress User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manchester-wordpress-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

suefernandes

unread,
Dec 16, 2016, 5:24:30 AM12/16/16
to Manchester WordPress User Group
Hi Tom,

Thats what I thought, but was going round in circles because it wasn't working.  Turned out it was in the filter settings of the Views template.  Toolset has turned out to be both a blessing and a curse in this project!

Thanks for your help!

Sue 
Reply all
Reply to author
Forward
0 new messages