Skip Navigation

[Resolved] How to display latest post with repeatable field groups to a Landing Page

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

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 3 voices.

Last updated by Waqar 2 years ago.

Assisted by: Waqar.

Author
Posts
#2480461
menu-items.png

We are trying to display the Repeatable Fields from the Latest Single Post Type to a Landing Page

Single Post
hidden link

Big News Landing Page
hidden link

We tried adding a filter with custom POST ID attributes but the views is still not displaying.

Sample Shortcode used on the Landing Page
[wpv-view name="big-news-lp-latest-scams" wpvrelatedto="16107"]

If you have a different approach we are open for suggestions. Thank you!

#2480521

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, on the following page:
=> hidden link

I can see there is a message "No items found" where you added the view you shared and it does not return any result - right?

Can you please share information about what repeating field group you created?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2483765

Hi,

Thank you for sharing the admin access details.

Minesh is on vacation so I'll be following up on this ticket.

I'll be reviewing the requirements and will be doing some tests on my website, to suggest the best way to achieve this.

Thank you for your patience.

regards,
Waqar

#2485277

Thank you for waiting, while I reviewed the requirements.

1. To show only the selected field's content from the view "Big News LP - What's New", based on the shortcode attribute value, I followed these steps:

a). In the view's template's content, I wrapped the shortcode for each of those 5 custom fields, inside the conditional statement, so that they're only shown if the shortcode attribute value is equal to a certain value ( e.g. property, wealth, business, etc ).

Note: To get the value passed through the shortcode attribute, I used the shortcode 'wpv-attribute':
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-attribute


[wpv-conditional if="( '[wpv-attribute name='custom-attribute']' eq 'property' )"]
[types field='whats-new-property'][/types]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-attribute name='custom-attribute']' eq 'wealth' )"]
[types field='whats-new-wealth'][/types]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-attribute name='custom-attribute']' eq 'business' )"]
[types field='whats-new-business'][/types]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-attribute name='custom-attribute']' eq 'shares' )"]
[types field='whats-new-shares'][/types]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-attribute name='custom-attribute']' eq 'yourself' )"]
[types field='whats-new-yourself'][/types]
[/wpv-conditional]

b). Next, on the page "Big News Test Page", I used the same view's shortcode, but with different shortcode attribute values for the "custom-attribute", for each of those custom fields:


<h3>What's New - Property</h3>
[wpv-view name="big-news-lp-whats-new" custom-attribute="property"]
<hr>

<h3>What's New - Wealth</h3>
[wpv-view name="big-news-lp-whats-new" custom-attribute="wealth"]
<hr>

<h3>What's New - Business</h3>
[wpv-view name="big-news-lp-whats-new" custom-attribute="business"]
<hr>

<h3>What's New - Shares</h3>
[wpv-view name="big-news-lp-whats-new" custom-attribute="shares"]
<hr>

<h3>What's New - Yourself</h3>
[wpv-view name="big-news-lp-whats-new" custom-attribute="yourself"]
<hr>

As a result, the content from only the respective field is shown, under each heading and each instance of the same view.

2. The items in the repeatable field groups are saved as a separate post type, related to the main/parent post. So, to show the related child posts/items from each repeatable field group of the "Big News" post, you'll need a separate view.

For example, suppose, you'd like to show the related items from the "Latest Scams Fields" repeatable field group.

a). You'll create a new view and set it to show the "Latest Scams Fields" post type in the view's content selection setting.

b). Next, you'll add a relationship query filter, so that the view only shows the child items related to the parent 'Big News" post in the loop (from the main view "Big News LP - Tab content").
( ref: https://toolset.com/documentation/legacy-features/views-plugin/displaying-related-child-posts/ )

c). Once this view is ready, you'll place its shortcode inside the loop of the main view "Big News LP - Tab content", which is already set to show 1 latest 'Big News" post.

This means that your parent view will take you to the latest 'Big News" post and the nested child view will take you to its related/child "Latest Scams Fields" posts.

Similarly, you can include more child views to show the data from the other repeatable field groups too.

I hope this helps and please let me know if you need any further assistance with this.