Sauter la navigation

[Résolu] Control other Post Types with Toolset

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Can we control other Software's Post Types with Toolset, so we could, for example, change the Post Types settings, such as add hierarchical true, or maybe remove archive true?

Solution:
The only way to control other's Post Types with Toolset is to actually replace those with Toolset.
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

That may be a solution in cases where the other software later can be removed - as otherwise the Post Type would be registered twice.
It is no solution when the other Software strongly relies on this Post Type and its settings.
How strongly that software relies on such settings of Post Types depends on the software, it's best asked to the support offered by 3rd parties.

You can always easily set any post type into a relationship, as there, the post type does not need to be created by Toolset, to work. Also, you can display such data with Views easily, as long the post type is not fully hidden to the public.

This support ticket is created Il y a 5 années et 6 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Marqué : 

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par marcusC-4 Il y a 5 années et 6 mois.

Assisté par: Beda.

Auteur
Publications
#1274777

I am using LearnDash on a site and I’d like to have hierarchy support for one of their post types (Lessons). I want to be able to say this lesson is a child of another lesson. Just like you can do with pages.

Is it possible to add that?

#1274871

You cannot edit non-Toolset Post Types with Toolset Types (unless native Posts and Pages, and those are only limitedly).

The only way to control other's Post Types with Toolset is to actually replace those with Toolset.
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

That is likely not what you want to do with the LearnDash Post type, as that Plugin will have reasons to register a certain post type the exact way they do.

However, setting a post type into a relationship wouldn't be the issue - for this, you could just add a Relationship in Toolset > Relationships between that and any other post type.

This is not the native WordPress Hierarchical Relationship but it is similar as you could create a One To Many relations, allowing one parent only, for many posts child posts.
The relationship cannot be within the same post type though, as Pages hierarchy could.

The best here would be:
1. Consult with the Developers of that Post Type (LearnDash) if it is OK adding hierarchy support to the type. They will know if this potentially could ruin their workflow or functionality.
2. If there is no issue with that you could use WordPress's API to filter the Post Types Args: register_post_type_args().
This filters the arguments with which a Post Type is registered, so you can alter them and return them back to the Post Type register method, adding hierarchy support.
See more information here https://developer.wordpress.org/reference/hooks/register_post_type_args/
An example can be found here https://stackoverflow.com/questions/10750931/wordpress-how-to-add-hierarchy-to-posts

Let me know if this doesn't help or I misunderstood the goal.

#1274929

Beda, thank you for the reply. Great info here. I’ll reach out to LearnDash support and also consider a new CPT to create these relationships.

#1274931

My issue is resolved now. Thank you!