Skip Navigation

[Resolved] Setting up the View in View to display related content

This support ticket is created 4 years, 8 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
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 3 replies, has 2 voices.

Last updated by Christian Cox 4 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1313613

I'm creating a Directory site with Events and Front-End User Profiles.

Sample User Profile: hidden link

On the Business Profiles which populate the directory, (set up as 1-many relationship with User Profiles) I'd like to show content from the User's Profile too. The same User that created the Business Profile.

I'd like to show the 'Certifications - Badges' from the User Profiles on their related Business Profile.

Sample Business Profile: hidden link

I've read about Views in Views and think I need something along that line but am not clear on properly setting it up. Currently, there is no Relationship between 'Badges' post-type and the 'Business Profile' post-type.

GOAL: The logic of my view in view would be: For the Business Profile Post author - where the content will be shown, display the related Badges to that same post author.

Note: The badge post author is fixed and Users do not create their own badges. Badges are only assigned on the back end.

#1313909

Note: The badge post author is fixed and Users do not create their own badges. Badges are only assigned on the back end.
Okay so if I understand you correctly, I cannot rely on the badge post author being identical to the Business Profile post author. So the only connection here is the Person post, which is related to both the Business Profile post and the Badge post. Is that accurate? "User Profiles" have a specific meaning in WordPress, so I'm going to refer to your post type as Persons.

If I'm correct above, then you can do this with two Views. First, create a View of Persons filtered by post relationship, where the Person is related to the post where the View is shown. In the Loop, you can insert a post title tag temporarily for testing purposes. Insert the View of Persons in the template for the Business Profile post, and you should see the related Person's post title appear.

Next, create a View of Badges, filtered by post relationship using the Person - Badge relationship, set by the current post in the Loop. In the output editor, insert the name of the badge, or the featured image, or a custom field - whatever you want to display. Then return to the View of Persons and remove the post title tag from the loop. Insert the View of Badges instead. Now you should see a list of Badges appear in the Business Profile post.

Let me know if you have questions about that.

#1314081
Badge-embed-final.png
Badge-embed2.png
Badge-embed1.png

I've created the two views, Badge Embed 1/2 and Badge Embed 2/2 as per your instructions. I've attached screenshots of each.

You mention:
Then return to the View of Persons and remove the post title tag from the loop. Insert the View of Badges instead. Now you should see a list of Badges appear in the Business Profile post.

I was unclear on that but after a bit of trial and error, I figured it out with the added assistance of this post: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

Thanks for your help!!!!

Here's the solution for anyone else that is doing it in a similar fashion.

It showed that I'd embed the view in this way: [wpv-view name="earned-badges-embed-step-2-2"]

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop wrap="3" pad="true">
		[wpv-item index=1]
		<div class="row ">
                        <!-- edited everything in this row div and replaced with my 'view name' shortcode -->
			[wpv-view name="earned-badges-embed-step-2-2"]
		</div>
		[wpv-item index=pad]
			<div class="col-md-4"></div>
		[wpv-item index=pad-last]
			<div class="col-md-4"></div>
		</div>
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]
#1314635

Okay great, it looks like you've got a working solution now. Thanks for sharing your final code for others.

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