Skip Navigation

[Resolved] Displaying the posts that are connected to a custom post that is connected to a

This support ticket is created 6 years, 5 months 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by davidR-12 6 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#592075

1. I have a post here:

hidden link

This displays a client post type in the right hand sidebar ('Chepstow'). This is connected to this post via a many to many child relationship.

The client page is here:

hidden link

Obviously, the client can be connected to many different posts via this relationship. I want a way to display all of these posts on any post that is connected to that client. How would I do this?

2. Each client also has a field that has twitter feed text in it (You can see it on the example client above). I want to display that twitter feed on any post connected to that client. How do I do that?

regards,

David

#592377

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - have you gone through our post relationship Doc:
=> https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
[Section: "Displaying Connected Content"]

If above Doc is not enough for you. I need to check your current relationship.

I also would like to confirm where you like to display all connected posts that is related to particular client.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#592904

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I can see its already working.

Please check here - this is client and at post relationship section I've added on more post.
hidden link

Now, when I see the client profile at frontend - I'ts displaying the post that is connected to client.
=> hidden link

Is this your expected output or I unfortunately misunderstood your requirement?

#592956

Hi Minesh,

No thats not it. You've just described the system that I have already set up.

A post will have a client connected to it. A client can have multiple posts connected to it. I want to display all posts connected to a client on EACH post.

So, for example, client A has post A and post B connected to it through a many to many relationship. On post A, in the sidebar post A and post B will appear (Although ideally not the post that is currently displaying).

I need the posts to appear on the posts, not on the clients (that's a system I have already set up as demonstrated by you).

Regards,

David

#593390

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

For example - I'm on this post currently:
=> hidden link

Now, above post is connected to client "Emyr Pierce" and I do not see there are more posts attached to client "Emyr Pierce" - could you please confirm which posts it should display and then I will try to offer you the solution.

#593411

Hi Minesh,

It wont display anything at the moment. I'm asking you how to do something so obviously I havent set it already as then I wouldnt need your help.

I dont know how to describe what i want any more simply so I'm just going to re-post it:

"A post will have a client connected to it. A client can have multiple posts connected to it. I want to display all posts connected to a client on EACH post.

So, for example, client A has post A and post B connected to it through a many to many relationship. On post A, in the sidebar post A and post B will appear (Although ideally not the post that is currently displaying).

I need the posts to appear on the posts, not on the clients (that's a system I have already set up as demonstrated by you)."

David

#593508

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - as per my understanding I've modified the code as given under:

I've created another view "display-related-client-posts" and added this view to "Clients Widget View" as given under:

 [wpv-view name="display-related-client-posts" ids="[wpv-post-id]" parent="[wpv-post-id id='$client']"]

You can check the query filters added to view "display-related-client-posts".

 Post relationship filter
Select posts that are children of the Post with ID set by the shortcode attribute parent.
eg. [wpv-view name="view-name" parent="123"]

Post ID filter
Exclude posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]

I've added one post "toolset test" that is connected to same client as per below link:
=> hidden link

And you can see same "toolset test" post with above link. could you please confirm is this the expected output?

#593557

Hi Minesh,

Thank you that works perfectly. So to point 2:

2. Each client also has a field that has twitter feed text in it (You can see it on the example client above). I want to display that twitter feed on any post connected to that client. How do I do that?

Regards,

David

#593567

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now, I've added following code to view "display-related-client-posts".

<div class="social-quarter">
[types field='client-twitter-feed' id="[wpv-attribute name='parent']"][/types]
</div>

I can see its displaying correct twitter feed. Could you please confirm.

#593833

Hi Minesh,

That works great as long as there is more than one post attached to a client. When there is only one post attached then the twitter feed does nto display. I have removed the 'toolset test' post form the client here and the twitter feed does not appear on this post:

hidden link

Regards,

David

#593857

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now, I've change the place where I've added twitter-feed code.
=> hidden link

It will show now even no posts found.

#593871

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please confirm - it works as expected.

#593905

Hi Minesh,

Can you tell me what you have changed as I need to transfer it to the live site.

Regards,

David

#593907

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've made changes to this view:
=> hidden link

I've added the following code just BEFORE the [wpv-layout-end] shortcode. You can see with above link:

<div class="social-quarter">
[types field='client-twitter-feed' id="[wpv-attribute name='parent']"][/types]
</div>
#593966

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I hope everything is working on your live site as well and we can close here 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.