Home › Forums › General Issues › Get all "values -> labels" for a Select field AND a specific post type › Reply To: Get all "values -> labels" for a Select field AND a specific post type
Hi there!
I will attempt to help… I have a question though…
.. how do you want to display the values?
For example.. you could append it to the content of a post, so then you would filter the_content() … and within your function you can write a conditional statement for a specific post type.
In general, when you have access to the Post ID, you can determine the post type using the code below:
if ( get_post_type( get_the_ID() ) == 'slug_post_type' ) {
//if is true
}
Depending on the function you are using, you may have access to the Post Object, or the Post ID directly… so you would replace get_the_id() with however you get the Post ID in the given situation.
Hope that helps! But please let me know if you need further clarification, and let me know the very specific goal and I can offer more direction if needed.
Thanks for your inquiry,
Keith
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.