Skip Navigation

[Resolved] RFG parent status

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

Problem:

Display content only if parent field is not empty and parent is status is published

Solution:

An example of how to achieve this can be seen below.

[wpv-conditional if="( '[wpv-post-id item='@event_dates.parent']' ne '' ) AND ( '[wpv-post-status item='@event_dates.parent']' eq 'published' )"]
[wpv-post-body view_template="loop-item-in-display-events-on-events-page"]
[/wpv-conditional]
This support ticket is created 6 years, 2 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
- 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 5 replies, has 2 voices.

Last updated by keithW 6 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1113033

We got some help previously to setup some conditional code to display RFGs and now we have a new issue:

https://toolset.com/forums/topic/split-split-using-types-to-create-events-only-show-active-events-with-rfg/#post-1078648 is the original post.

If we create an event in draft status or change an event to draft, it's still displaying the RFGs. Minesh provided me with the below code to put into the Loop Editor:

<wpv-loop>
[wpv-conditional if="( '[wpv-post-id item='@event_dates.parent']' ne '' )"]
[wpv-post-body view_template="loop-item-in-display-events-on-events-page"]
[/wpv-conditional]
</wpv-loop>

How can I modify this so it checks to make sure the parent event has a published status?

#1113171

Shane
Supporter

Languages: English (English )

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

Hi Keith,

Thank you for contacting our support forum.

So this code here is to display if the post date on a parent is not empty correct? But you only want this to display only if the post has a parent is set to published?

Please let me know.

Thanks,
Shane

#1113173

Shane,

Correct, the code we have now makes sure that if an event is deleted, that any corresponding RFGs don't display. We now need to also make sure that the parent is set to published because RFGs for drafted events are displaying.

#1113218

Shane
Supporter

Languages: English (English )

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

Please try the code below and let me know if it helps.

[wpv-conditional if="( '[wpv-post-id item='@event_dates.parent']' ne '' ) AND ( '[wpv-post-status item='@event_dates.parent']' eq 'published' )"]
[wpv-post-body view_template="loop-item-in-display-events-on-events-page"]
[/wpv-conditional]

Thanks,
Shane

#1113232

Thanks Shane. Only thing that I needed to change was the status from published to publish and it works perfectly.

#1113233

My issue is resolved now. Thank you!