Home › Forums › Front-end Issues › How can I apend code before and after image? › Reply To: How can I apend code before and after image?
This code should help you out if you are returning an image url
<img src="<?php the_field("image"); ?>" alt="">
Replace image with the field name that the image is stored in.
If you want to get a specific image image then set the following options.
Return an “image object” to the front end when the field is called
The image object option will return different properties and image sizes for the image uploaded. The image sizes can be accessed using the following
<?php $image = get_field("image"); $image = $image["sizes"]["image_size"]; ?> <img src="<?php echo $image; ?>" alt="">
Replace “image_size” with the image size name that you would like to show. If you do not know the name of the image sizes, use the following and then take the name from it.
$image = get_field(“image”);
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.