Skip Navigation

[Resolved] Linking two of the same Custom Post Type posts together to display side by side

This support ticket is created 5 years, 7 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by barryG-4 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1235767

Tell us what you are trying to do? I have a custom post type called girls. When editing a girl post I'd like to be able to multi select other girl posts in a list or series of check boxes to link to this one girl post, so that on a girl post page, viewers will see thumbnails and custom field data, images etc of other girl posts related to this post. Is that possible. I can see the post relationship option in custom fields but the girls CPT is greyed out in my Girls Field Group. This can't be done by taxonomy association. I need to manually select one or more other girl post from a list of the girl post titles.

Is there any documentation that you are following? No

Is there a similar example that we can see? No

What is the link to your site? Apologies for the content but this client is an escort agency in the UK. hidden link

#1235825

Hi, I'm having a go at fixing this myself if I can. I've added a taxonomy called Duos. I've created two test items in this taxonomy called 'Nadia & Ruby' and 'Adrienne & Alexa'. I've added each relevant girl to those two items and have created a basic Toolset View that displays the taxonomy items here:

hidden link

It's a start but I used an Elementor Posts module to produce a gallery layout that is both responsive and one that looks good to me here:

hidden link

So am I on the right track. Could I somehow inject my basic view into an Elementor Posts Module so that it displays like the main gallery page but with each pair of posts in a separate container so you see a gallery of 'pairs'?

Many thanks,
Barry.

#1235847

When editing a girl post I'd like to be able to multi select other girl posts in a list or series of check boxes to link to this one girl post, so that on a girl post page, viewers will see thumbnails and custom field data, images etc of other girl posts related to this post. Is that possible.
Not with Toolset's post relationship features, unfortunately. There is currently no way to relate posts in the same post type using post relationships. We plan to address that in a future release, but it's not ready yet. Instead, you could use a taxonomy or a custom field. Taxonomy is probably more performant for searches. One way to do this is to create one term in the taxonomy for each Girl (I suggest using the Girl post's slug as the slug of the term). Let's say Nadia is the Girl. You create a term "nadia" in the taxonomy. Then if you want to relate Nadia to Ruby and Adrienne, you edit Ruby and Adrienne's Girl posts and assign the term "nadia" to both of them. Then vice versa, you assign "ruby" and "adrienne" to Nadia's Girl post. This gives you the ability to create a View of Girl posts, filtered by the taxonomy, and define the term using a shortcode attribute. You can easily pass in the current Girls post slug, so all the Girl posts with that same taxonomy term will show up in the results. It's complex, but it's also quite flexible.

Could I somehow inject my basic view into an Elementor Posts Module so that it displays like the main gallery page but with each pair of posts in a separate container so you see a gallery of 'pairs'?
The Elementor Posts module and Views are not integrated like that, unfortunately. One alternative is to create a separate post type called "Duos" and make it a parent of "Girls" in a one-to-many relationship. Create a Duo post for each pair of Girls. Then your View could loop over Duos, and display both children as a pair using a nested View. This may introduce some problems with search, though, because you would have to search and filter based on criteria of the Duo post, as opposed to criteria of the Girls posts. It's possible, but clunky. Depends on how your search works.

Let me know if you have follow up questions, and we can continue our discussion.

#1236402
Screenshot 2019-04-26 at 19.51.41.png

Hi Christian,

Thank you for your detailed thoughts on this. I do intend one day to stop bothering you.....I'm so close to finishing this site. I think this particular issue is too complicated for me with my limited knowledge of Toolset at the moment to go ahead with the above though.

I've created a new set of custom fields called the duo girls field group and have marked them as active for the Girls CPT.

I've created one Girls post for a duo and have filled in the extra set of fields (girl 2 age, girl 2 height etc).

I'm editing the Elementor template for the Girls post page and thought I'd be able to add shortcodes for these extras fields. The age box shows this from the girls field group originally: [types field='age'] [/types] and now I'd like it to show [types field='age'] [/types] & [types field='girl-2-published-age'] [/types] (from the duo girls custom field group).

So if the profile is for a duo, it will show the extra field, if the field is empty in the case of a single girl profile, it will show nothing.

Only problem though is that the shortcodes for the duo girls custom fields don't work. Is there something simple I can do to get this to work. I could of course enter the extra fields into the Girls group but I'd like to display the extra fields to admins at the foot of the page so they are in a separate section with a description as most profiles will be for single girls.

Is this something you can help me fix please?

Many thanks,
Barry.

#1236580

My issue is resolved now. Thank you!