Perfect !!!!
I will definitely tweak this next time if need such kind of thing again.
The most active forum support I must say.Thanks all for your support so far.
Kind Regards,
Abdul Mannan
Thanks Jonathan. Your help really means to me.
So, your previous code works for me by placing LIKE instead of =
Everything is working now, but just for the sake of knowledge, can you let me know about any other approach to achieve what i want, so i can at least in future i will not implement that backward approach 🙂
Kind Regards,
Abdul Mannan
Hi Jonathan. I tweaked my self i bit and made it work.
The code you posted above works well if i change the following thing
‘compare’ => ‘=’
TO
‘compare’ => ‘LIKE’
But will you please let me know, what difference does it make. Will it cause me trouble in future for any particular scenario ?
Also
‘orderby’ => ‘meta_id’,
‘order’ => ‘DESC’
is not working.
Thanks for your help so far.
Please let me know if i can handle this with any other way.
I just want that if some one while adding the custom post (say product) selects the page ABC( id 568), that post will appear on that page. This is what i want. I have custom page templates for all pages also.
Please help me out of this, if its possible with custom fields plugin.
Thanks.
Hi Jonathan. Thanks for the piece of code but it didn’t work.
Don’t know why. This is what I have in database right now. Please see the screenshot.
I have custom templates for all pages and ran your query in one of the template but didn’t work.
As you can see in the screen shot, the meta value consists of the value 568 in serialized form.(which is actually the page id)
So if i am on that page(568), will your query returns the post_id 5224 record ?
Thanks.
Hi Mike.
Thanks a lot for simplifying the logic but i think i have multiple values in meta_value so how can i make a condition that if the page id appears in the meta_value then show that post here.
Also, this is what i have currently in the field
post_id = 116 (eg)
meta_key = make_partner_featured
meta_value = meta_value = a:1:{i:0;s:3:”mypageid”;}
mypageid is what i have selected while adding a partner.
I have attached 3 screenshots, 2 of field group and one for the page where i want it to appear. As i am not an expert in wordpress so it would be great to make a query to fetch that record or the piece of code that will fetch the required record.
Thanks Mike, I really appreciate your help.
Kind Regards,
Abdul Mannan
Thanks Mike for such quick response, wasn’t expecting 🙂
I have mentioned details in the screenshot but let me tell you that you understand coorectly, that when user is on page_id=10, display all the products that have page_id=10 assigned to it.
What i have explained in the screenshot is the logic that came in to my mind. Any suggestion on how to achieve my goal along with sample code, will be highly appreciated.
Thanks a lot.
Kind Regards,
Abdul Mannan
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.