Skip Navigation

[Resolved] Showing repeatable fields in a view prevent to repeat value.

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

Last updated by Himanshu Agarwal 3 years, 11 months ago.

Assigned support staff: Waqar.

Author
Posts
#1204419

Hi,
I have created a repeatable fields group and shown in a product page as accordion. You can this here hidden link in faq section.

This is working fine here with query filter "Select posts in Any relationship that are a related to the current post in the loop" .

I also created another view for showing all repeatable custom fields value without any query filter.
You can check this here. hidden link

When i am showing all faq its repeating the value it means if I assign a faq to five product then its showing five time, i want that it must show only one time.

Another thing is that its not showing faq that is not assign to any product.

Please help me to solve this issue.

#1204792

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Himanshu,

Thank you for waiting.

I've looked into your current set up of FAQs and noticed that if you'll remove the repeating field group and instead use a dedicated custom post type for the FAQs, both your concerns will be taken care of:

- Same questions won't be repeated
- You'll be able to add and show FAQs, which are not related to any specific product

An additional benefit would be that you won't have to type the same questions and answers again if multiple products will need to show the same FAQ.

You'll create a new custom post type "FAQs" so that each FAQ entry can be stored as an individual post in it. The post's title can be used for the question and the post's body/content can be used for the answer.

Next, you'll create a "Many-to-Many" relationship between "FAQs" and "Products" post type, so that multiple FAQs can be linked with multiple products:
https://toolset.com/documentation/post-relationships/

You'll then adjust the "FAQ View" view, so that it only shows those FAQs, which are related to the current single product, whereas the "All FAQs Accordion" view, will show all "FAQs".

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

regards,
Waqar

#1205258

Thank you Waqar,

Your solution working fine i created a custom post type and created a relationship from faq to products.

Now faqs are not repeating in all faqs.

I need one more feature in it.

I have some faqs the i want to show only in a specific product, It means if i define a faq for a product it must be not shown in all or any other product, that faq only shown in that specific product.

In simple way, if i add a faq in FAQ (post type) then it can be selected in all products and we can show them in any product, But if a faq is added in a specific product then it must not show in any other product or in "All FAQs".

Is this possible, if yes then how could i achieve this?

#1205509

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Himanshu,

For this updated requirement, it would be better to use two different custom post types:

1. General FAQs
2. Product FAQs

"General FAQs" will be used for the items which can be used as common FAQs for products or for "All FAQs" page.
"Product FAQs" will be specific to a particular product and will only show on products, with which they have a relationship.

regards,
Waqar

#1205552

Thank you!