Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across the different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
Thanks alot for your help!
Cheers,
Nick
Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across the different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
Thanks alot for your help!
Cheers,
Nick
Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
Thanks alot for your help!
Cheers,
Nick
Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across the different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
https://www.awesomeacf.com/responsive-images-wordpress-acf/
Thanks alot for your help!
Cheers,
Nick
Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across the different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
https://www.awesomeacf.com/responsive-images-wordpress-acf
Thanks alot for your help!
Cheers,
Nick
Hey, how can I solve following situation. I have spent hours of looking for an easy way.
I have defined variables for acf-fields and acf-subfields. That works quite nice and I don’t need to use the loop of »if have rows … the row … etc«. For me that helps to keep the acf-fields clearly arranged across the different pages.
How to use the »$image« variable from top instead of »get_sub_field(‘subfield’)« in the image-tag »awesome_acf_responsive_image« function which doesn’t work since I don’t have the loop for using »get_sub_field«?
<?php
$field = get_field('header-work');
$image = $field['image']; //acf-image-field is set to return id
?>
<section>
<div class="image">
<img class="img-fluid" <?php awesome_acf_responsive_image(get_sub_field( 'subfield' ),'thumb-640','2560px'); ?>>
</div>
</section>
Here is the link to the function
https://www.awesomeacf.com/responsive-images-wordpress-acf
Thanks alot for your help!
Cheers,
Nick
The topic ‘Using function »awesome_acf_responsive_image« with variables’ 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
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.