Hi,
I'm trying to select from a CPT (slug: 'raw-material') the rows which have the value 'TOP NOTES' in wpcf-volatility-rmt (as a custom field).
After that I would process the rows obtained filtering by a specific meta_value of a repeatable field (slug: type-fragapp-rmt-rg) that is in a RFG of the same CPT (slug: 'raw-material') named 'rmt-rg-frag-app' (as slug).
How I can solve the issue? Have you suggestions?
Thank you very much in advance for your support.
This is the code that I tested without results. Is the first section of TOP NOTES; the page will contain three different section TOP NOTES, MIDDLE NOTES and BASE NOTES with the same code replicated. I will change only the "value' => 'TOP NOTES'" in the first query with MIDDLE NOTES and BASE NOTES.
Hello. Thank you for contacting the Toolset support.
It seems the code you shared is not the full code you are using as I do not see the end while that ends the while loop.
I do not know why you use the return statement as well: return $query_ch;
If you can share problem URL and access details and tell me where exactly to which file you have added the above code I will further look at it and try to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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.
Hi Minesh,
thanks for your reply.
I posted the piece of code that could be wrong.
The first query is ok and i can see the correct result (filtering by volatility).
The while loop is frustrating 🙂
The toolset_get_related_post args are correct?
I'm sorry but during the cleanup of the code before posting I deleted some lines and uncommented others.
I'm testing this function in localhost. Is necessary a test in real conditions?
Thank you Minesh for your support.
But again I still wonder, why you have added a return statement? return $query_ch;
- As the control will be return from that vary line of code and the next code lines you have added will not be executed.
It's hard for me to guide you in the right direction without the test site where I can see the issue as it can be anything.
As you are using the foreach loop and within foreach loop you are trying to get the related repeating field group posts (so it is possible that the toolset_get_related_posts() will return many results) so you will need another foreach loop to display the content of your related posts.
Minesh,
I'll upload the file in my remote server in the next hours and I'll give you the credentials to test everything.
Many many thanks for your support.
Sure, Please send me information that what field values you want to display exactly where and where the file I can find where you added the code you shared.
I have set the next reply to private which means only you and I have access to it.
Hi Minesh,
Tonight I tested the get_related_posts function with a different code and a foreach iteration of the array. I solved my issue and no need to spend your time.
Thanks of all.