hi there,
hope you all are doing well.
i followed the gym and trainers ... one question came up ...
lets say i use the standard wp-posts as my blog. in there i created a parent-category called "gyms".
is it possible to get an automatically created child-category in my wp-posts as i add a new gym in the cpt for gyms ?
lets say i add a gym called 'gym001' to the cpt-of-gyms and then automatically i will get an additional child-category in my wp-posts with something like: .../category/gyms/gym001 (which will list all the 'gym001' posts).
and as this is possible, do you mind to share how this could be achieved ?
because, if so, it also should be possible to have a posts-slider under the cpt-gym .../gym/downtown-fitness-center/ that shows the latest three posts from the blog/wp-posts category of this specific gym.
hope you got my idea.
thanks in advance
klaus
Hello,
There isn't such kind of built-in feature within Toolset plugins or WordPress.
In your case, it needs custom codes, for example, when user create a "cpt-of-gyms" post, you can use WordPress action hook save_post to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/save_post/
In this PHP function, get the new post's title value:
https://developer.wordpress.org/reference/functions/get_the_title/
And use above value to add a term into taxonomy "category":
https://developer.wordpress.org/reference/functions/wp_create_term/
Hello Luo Yang
hope you are doing fine, best wishes from Taiwan.
i see, understand your answer.
hmmm, but wouldn't make this toolset more round ?
could or maybe should this be a feature for upcoming versions ?
is it asked too much as i need a more precise example than just the links to your documentation ?
kind regards
I hope you are fine too.
As I mentioned above, there isn't such kind of built-in feature within Toolset plugins or WordPress Core, I don't think we can implement such kind of feature.
With the structure you mentioned above, it will conducts other problem, for example, when you edit/delete a "cpt-of-gyms" post, you need to edit/delete the corresponding "category" term.