Home › Forums › Front-end Issues › i need to use shortcode to show each post ID
I’ve seen this shortcode
[acf field="field_name" post_id="123"]
to show the field from post id but how can I show the field from every single post ID in the same post type.
[acf field="field_name"]
will show the field from the current post, you only need to add the post ID when showing a value from a different post.
Hi John, I need to apply this shortcode to show the archive single post of “Videos Post type” so I use this shortcode [acf field="video_url" post_id="2791"]
but the problem is it will show only video from post id 2791 instead of other video’s post. So I just need to know how to use this kind of this shortcode [acf field="video_url" post_type="Videos"]
. Is it possible to do this with the ACF shortcode?
There isn’t any way to do anything dynamic with the ACF shortcode. The ACF shortcode is very simple. If you want to show a list of posts that requires a loop (have_posts), while in this loop ACF would show the current post values.
I don’t really know what you’re doing or how your building your archive page, so I can’t really suggest anything, I might not be able to suggest anything anyway. Any suggestion I give would require custom coding.
Could you please give me an example of custom code in function.php file or any resoures?
It is still not clear to me what you are trying to do or how you are trying to do it. You’re going to need to provide enough detail so that I can figure that out.
Well, I tried to create a dynamic pop-up by using Elementor Pop-up to show the videos from its post(Screenshot). But for now, the shortcode that I write shows only one from post ID A. I find a way to make it show as a dynamic( when I click on other thumbnails it will show the video from its post). you can see the result at this link on the video thumbnail. Sorry for the confusing I’m a noob at developer.
You must be logged in to reply to this topic.
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.