Skip Navigation

[Gelöst] CPT documentation with TOC

This support ticket is created vor 2 Jahre, 7 Monate. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Nigel vor 2 Jahre, 7 Monate.

Assigned support staff: Nigel.

Author
Artikel
#1614429

How to create a TOC for a CPT of documentation

#1615085

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

Timezone: Europe/London (GMT+00:00)

You have a couple of choices.

One is to make a "Chapter" post type, and then make a one-to-many relationship between Chapters and Documents, organising the documents into chapters.

To display on the front-end you would have an outer View to display the chapters, and an inner View to display the documents for that chapter.

Ordering might be an issue. You could add a numeric custom field to the document post type to specify ordering. When editing a chapter where you can see the connected documents at the bottom of the page you can choose to show the order field and then re-order the documents by it. (You would use the same field to order the documents on the front-end, too.)

See this documentation for details: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

Alternatively, you could make your documentation post type hierarchical (an option in the settings for the post type) so that you can nest document posts, treating the top level as "chapters" and the nested level as "documents".

If you use the plugin I recommended in the previous thread (WP Nested Pages) it would give you a simple drag and drop interface for organising the documentation in the backend. I expect it will have something to reproduce that ordering on the front end, but you would need to consult its documentation.