Skip Navigation

[Resolved] Relationship of posts and front end display

This support ticket is created 7 years ago. 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)

This topic contains 7 replies, has 2 voices.

Last updated by Beda 7 years ago.

Assisted by: Beda.

Author
Posts
#590661

Hi there,

I want to create a documentation site for my clients to log in to.
I have created a CPT for documentation/document and another as clients.

I want to create quite a few documents that will be categorised on how to use their website. I will create many generic documents that can be used for different customers.

When I create all the documents for use on the documentation site, I want to be able to assign only the relevant documentation posts to each client so that only the post or set of posts that I select per customer will be available for them to read.

I am thinking this is done through post relationships?

I will then want to be able to rearrange the order that the posts (CPT documents) show on the front end for each client.

Could you please elude on how I create that relationship to be able to select which documents the client will see from the single post of the client.

I am hoping I can go to edit "John Smith", then select from a field a number of posts (documents available) to assign to this client.

Regards,

Ciaran

#590781

I don't think you need a relationship of this kind.

A Taxonomy, even a flat one, is enough.
You need to set the correct terms to the posts, and then create a View that shows those posts.
After, either with a Query Filter or even conditional HTML you can hide all posts but the one you want to display, per user, dynamically.

You will create the View, and use conditional HTML on the Term, as shown here:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This would then hide all unwanted posts from the users.

The terms you set up are in the best case populated for example with the user's name, keeping it simple for organization.

#590787

Hi Beda

Thank you for responding. However I think you have misunderstood whay I am wanting to accomplish.

I have many different posts that are essentially reusable sections of content for documentation.

I want to bee able to select different posts that should be available for each client. These will be help documents that will be available for them to read regarding what I am wanting them too read.

The custom post type documents needs to be a complete list of available posts that I can select at the bottom.of the edit post of clients. That way the documents that I select to display per customer will show on their view.

#590804

Ok, if you require it to be chosen at the bottom of the Client's post, then this Posts can be only Child to the Client, this is correct.

But you cannot associate a Child Post to MANY parent posts of the same type.
Hence you need a Many To Many Relationship or a Taxonomy as I suggested.

In the Many To Many Relationship you can either wait for the new features to be released which allow to create them without any intermediary post type.
Currently you need an intermediary post type.

This post type is child to Client AND Document.
Then, you create a NEW intermediary post for each connection between Clients/Document.

This means in the Client's edit page you will choose an Intermediary post, in where you can set a parent Document.

Then in a View you display that intermediary post type (that belongs to the current page(client)), and then in the Loop you call the parent Document Post fields.
This is elaborated here:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/

#590822

I think I am a bit lost now on the intermediary post. Should I now few at a new CPT called document list? That way I select the posts to show in document list then select which document list yo add to the client?

How long until this feature of not needing to do this way?

#590824

The new features will start to roll out soon, but it will still take some weeks at least.

Currently you can set up the Document, Client and Intermediary post types.
Make the Intermediary Post Type (IPT) child to both Documents and Clients.
Set up several Clients and Documents.
Now create some new IPT posts and for each select the right mix of parents (correct clients and correct Document)
Each IPT will connect the client to the Document he can see.

If a client cannot see the same document it needs a new IPT.

This IPT is then displayed (queried) in the View, and in it's loop you call the Parent Post Fields of Document and Client.

The Documentation shared has as well examples to work on, although they do not use the Document/Client scenario but bands and events.
Those are your Clients and Documents.
The appearance is your IPT.

#590825

Thank you very much for that explenation. I will try get my head around this IPT. Thank you for the link, I will go read through and create whay I need to do.

If I fail I will be back to ask more precise questions.

#590830

Sure!

Next week eventually a colleague will cover me here, as I will be away.

Please do not hesitate to ask, in case you have doubts!