Home › Forums › Front-end Issues › Displaying Sibling ACF Fields › Reply To: Displaying Sibling ACF Fields
I can’t give you exact code because I don’t have any handy.
How you would get a list of sibling pages would depend. I’m not sure by reading your question if you are currently displaying the parent page or one of the other siblings.
If you are displaying the parent page then what you need to do is do a WP_Query to get all of the child pages of the current page using the
post_parent parameter https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters.
If you are showing one of the sibling pages already then the first thing you need to do is to get the parent id of the current post https://codex.wordpress.org/Function_Reference/wp_get_post_parent_id and then use this value when doing the query I mentioned above.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.