Skip Navigation

[Resolved] Unable to display post with relationship

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user was having some issues displaying their child posts using views.

Solution:

To display your child posts I would recommend taking a look at the documentation below.

https://toolset.com/documentation/user-guides/displaying-brother-pages/#3

This support ticket is created 4 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by lauraH-2 4 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1261225
Workout Title  Goal Yoga Ma.jpg
Edit View ‹ CREW FIT — WordPress.png

I have a site using one to many relationships. Each one Coach can have many Workouts. On the Single Workout page, I am trying to show other Workouts by the same Coach in the side bar. I have created the Workout Single page with no problem. In the sidebar, I have created a View that I hoped would display other Workouts by the same Coach. When I uncheck "
Don't include current page in query result" and set the offset to skip none, the same Workout shows that is the workout shown on that single page. But when I either check the query box or set the offset to 1, then it shows "no results".

I am including screenshots of the Single Workout page since the site is still under development as well as the View I'm using within the Single Workout Content Template.

Since I can't capture the Content Template in a screenshot, here is the code for that:

<span class="title">[wpv-post-title]</span> [types field='coaches-profile-pic' class="tiny-profile" title='%%TITLE%%' alt='%%ALT%%' size='custom' width='50' height='50' resize='proportional' item='@coach-workout.parent'][/types] <span class="coach-name">By [types field='coaches-name' class="coach-name" item='@coach-workout.parent'][/types]</span><br>
<div style="margin-bottom: 50px;">[wpv-conditional if="( $(wpcf-youtube-link) ne '' )"][types field='youtube-link'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-video-upload) ne '' )"][types field='video-upload'][/types][/wpv-conditional]</div>
<div class="row">
	<div class="col-sm-6">
      <div class="workout-content"> 
      <h2>Workout Details</h2>
      <strong>Description:</strong><br>
      [types field='short-description'][/types]
      <strong>Expected Lenght of Workout:</strong><br>
      [types field='workout-length'][/types]<br><br>
      <strong>Recommended Equipment:</strong><br>
      [types field='equipment-needed' separator='<br/>'][/types]<br><br>
       <strong>Great for these energy levels:</strong><br>
      [types field='energy-levels' separator='<br/>'][/types]<br><br>
      <strong>Goals:</strong><br>
      [types field='goals' separator='<br/>'][/types]
      </div>
      <div class="workout-content">
        <h2>Steps to this Workout</h2>
       [types field='steps'][/types]
      </div>
       <div class="workout-content">
          <h2>Instructions for this workout:</h2>
         [types field='workout-images' title='%%TITLE%%' alt='%%ALT%%' size='full' separator=', '][/types]
         <div class="tb-repeating-field tb-repeating-field--crop"> 
    <div class="tb-repeating-field--masonry">
        [wpv-for-each field="wpcf-workout-images"]
            <div>
                <a href="[types field='workout-images' size='full' url='true' separator=''][/types]" >[types field='gallery' output='normal'  align='none' size='full'  proportional='true' resize='proportional' title='%%TITLE%%' alt='%%ALT%%'][/types]</a>
            </div>
    [/wpv-for-each] 
    </div>
</div>
      </div>
  </div>
	<div class="col-sm-6">
      <h3>FOR A SIMILAR WORKOUT</h3>
      [wpv-view name="workout-layout-for-sidebar-of-workout-single-page" limit="1"]
      <h3>TAKE IT UP A NOTCH</h3>
      [wpv-view name="take-it-up-a-notch-workout-layout-for-sidebar-of-workout-single-page" limit="1"]
      <h3>TAKE IT DOWN A NOTCH</h3>
      [wpv-view name="take-it-down-a-notch-workouts" limit="1"]
      <hr style="border-color: #19e59a;">
      <h3>MORE FROM <span style="text-transform:uppercase;">[wpv-post-link item="@coach-workout.parent"]</span></h3>
      [wpv-view name="more-from-same-coach-workout" limit="1"]
      
</div>
#1261385

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laura,

Would you mind allowing me to have access to the site so that I can check on this for you ?

I would like to see how the relationship is setup in order to give a proper response on this.

Thanks,
Shane

#1261571

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laura,

This should be fine now.

What I did was to filter your view by the post parent ID.

Thanks,
Shane

#1261573

Perfect! I tried that but couldn't get it to work. I'll take a look at what you did. Much appreciated!

#1261575

My issue is resolved now. Thank you!

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