I think the ‘0’ was the key. It is working, but for some reason I have to go back and save all of them again now to get it to work. Thanks again!
Last night I changed it to what I had previously. Which worked for all but the two advertising items. I put in you’re code:
if (get_post_meta($post->ID, 'media', true) == '0' )
But take a look, now most of the items link to the permalink, not the image file as is intended, so something isn’t right. Thoughts?
I may have spoke too soon. This seems to work for all of the posts I created BEFORE I changed the php source code, but new ones that I save are not working correctly – they are linking to the post.
So, I guess this didn’t work. Am I going about this wrong? Other thoughts?
YES! YES! YES! You saved me! I’ve been banging my head against the wall for hours. This was great, thank you Vikestart!
You’re the best Elliot! Thank you!
Elliot, as always, thanks for the reply. Do I add that filter in my code where I am call the field? This is how I am doing that now:
<?php the_field('property_photos'); ?>
Thanks!
-Shawn
Thanks for the reply. I’m not sure how to demonstrate that. The only way to really see it is in the page source. If you view this page and view the source, you will see an image named lemons-avacados-01-80×80.jpg. In that image tag is a class called “colorbox-001”. This was automatically inserted when I inserted that image into the WYSIWYG editor for that page.
By contrast, view this page and view source, you’ll see an image named meadow-lakes-01.jpg but there is no class for colorbox even though it was inserted through the WYSIWYG custom field. Does that help?
Sure, I’m attaching three images. One shows the public view. The pink area is the ACF WYSIWYG content, the green is the default WP WYSIWYG (there are no images in there).
The other images show the admin screens for these fields. I can insert a class manually in the ACF WYSIWYG editor, that just becomes cumbersome when there are multiple images. I was hoping to streamline the process by having a class inserted automatically for any image added to that field.
Any help would be appreciated.
Thank you. You are the best!
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.