I’ve created a Custom Post Type, “Slide”, and I’m attempting to load a random slide image, with caption, in my sidebar. I’m using the ACF Plugin for the post/slide creation. The code below is what I have in my sidebar.php – I get a random post loaded in the sidebar (showing Title and Caption) but the image URL does not output/echo, just <img src="" />.
Do I look to have the ACF code wrong or maybe using the WP_Query wrong?
Doh! Looks like in troubleshooting I had actually changed the return value from “ID” to “URL”. All is working now (with moving the code as you suggested, which I had tried before, but after having changed the return value and forgetting).
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘Custom Post Type "Slide" – Random Image’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users