Awesome! Just what I was looking for. Thanks all above 🙂
Found the culprit!
I had an error in my function to add async and defer attributes. A typo.
Seems to have fixed it anyway…
thanks John, I did wonder about that array thing
Got it working… much simpler!
<?php echo do_shortcode('[download id="'.get_sub_field('download_id_number').'" template="box-custom"]'); ?>
yes please please make this a core feature!!! So hard for clients to re order rows if there’s loads of sub fields.
rockeypjb thanks for that direction above. I have selected an ACF date though when uploading an article in the post admin so shouldn’t it then print in the format I have selected in the display settings?
Using your suggestion above if I enter that as is without changing the filedname I see it prints the current date. I add in my own field name and it stops printing the page at that point (I’ve changed the date format).
<?php $date = new DateTime(get_field(‘published_on’));
echo $date->format(‘d/m/Y’); ?>
What I ideally want is something like the below (but this doesn’t work)
<span>Published on:</span>
<?php $published_on = get_field(‘published_on’);
if ($published_on) {
echo $published_on->format(‘d/m/Y’);
} else {
echo ‘Not known’;
} ?>
Is there something simple I’m doing wrong here?
Ok I changed the return value to Image URL and now it works with this call
`” alt=”” />’
What is the Image Object option for?
hmm, won’t let me paste the image code above but the src in the image tag is basically the info that was getting printed on the page in my first post.
So src=
`79, spear_fishing, spear_fishing, , spear_fishing photo, image/jpeg, http://site.com/wp-content/uploads/2014/05/spear_fishing.jpg, 1240, 480, Array
OK I just found the code examples page and replaced the call code to the following:
<img src="<?php the_field('left_square_image'); ?>" alt="" />'
Now, the generated code is as follows so it displays a missing/broken image icon
‘
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.