Skip Navigation

[Resolved] show fields from other post type

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
- 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 reply, has 2 voices.

Last updated by Nigel 6 years, 5 months ago.

Assisted by: Nigel.

Author
Posts
#1088699

Tell us what you are trying to do?
i have two post types
1. voters
2. poll-address
i want to show the poll address by voter. i'm using the custom field "pole-number" in both post types.

in voter there is the poll number
in poll-address there is the poll number and all the other fields like address, poll name and on.

i want to search voter by "voter-id" and show fields from "voters" (first name, last name...) and from the post type "poll-address" (poll-address, poll name,...)

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?
hidden link
(please don't show the link in public i be happy if the all ticket will be privet)

i made a new user
[edit]

#1089284

Nigel
Supporter

Languages: English (English ) Spanish (Español )

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

Hi there

It sounds like this is something you should be using post relationships for, I suggest you check out the documentation about that: https://toolset.com/documentation/post-relationships/

However, if you want to manually manage post connections as you are doing with a poll-number then it is possible when displaying one post (e.g. a voter) to display fields from the other post (i.e. the poll address).

Say you are displaying a voter (either an individual voter, or a list of voters from a search View).

Where you want to display fields from the linked poll-address you need to insert another View, this time which displays the poll-address post and which includes a Query Filter for the poll-number field where the value comes from a Views shortcode argument.

Then when you insert the wpv-view shortcode you manually add the argument, using a types shortcode for the poll-number field to provide its value.

You can read about passing values to Views here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

In short:

- your Voter post has a poll-number field (which you can insert with a shortcode generated by the Fields and Views button)
- you are going to pass this poll-number (as a shortcode argument) to a View that displays poll-address posts
- that View will use a Query Filter for the poll-number to only show the poll-address with a poll-number that matches that passed by the shortcode argument
- the output of that View will contain whatever fields from the poll-address post you want to appear in this context