Home › Forums › General Issues › image Alt Text Issue
here is the problem: https://www.docdroid.net/NCL4j9z/presentation1.pdf.html
here is the this page script: http://pastebin.com/8sq9S5UG
Page url: http://bangladeshturisum365.com/test/services/radiology/
ACF version: 4.4.7
WP version: 4.7.2
Please help someone
As you can see you haven’t inserted an alt text in your code:
<img src="<?php the_sub_field('post_slider_image');?>">
So you would need that. What return value are you using in your image field settings? Must be URL. So you would need to change that into “Image Array”.
In your code you would define the image as:
<?php $image = get_sub_field('image'); ?>
And print it out like:
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
Also, the has_sub_field function is outdated, see:
have_rows was added in 4.3.0:
how i do this?
1: if i select flexible content to image and then select image object
from here: https://s17.postimg.org/v56sbs7b3/Edit_Field_Group_Word_Press.png
then this image slider just gone:
2: so please tell me exactly what i need to do.what i need to select
from the ACF field and also what code i need to input thats php file
The sidebar php file code is here: http://pastebin.com/8sq9S5UG
You should not change any field but your image field.
Inside your ACF setup, you would have a field called post_slider_images (probably a Repeater field), and inside that you would have an image subfield called post_slider_image.
On that post_slider_image field, you should simply change “Return value” to “Image Array”.
If it is a repeater field (post_slider_images) with a subfield (post_slider_image), your code for printing the image should then look like this:
<div class="gallery cycle-slideshow clearfix" data-cycle-timeout="6000"> <?php if(have_rows('post_slider_images')): ?> <?php while(have_rows('post_slider_images')): the_row(); ?> <?php $image_data = get_sub_field('post_slider_image'); ?> <img src="<?php echo $image_data['url']; ?>" alt="<?php echo $image_data['alt']; ?>" /> <?php endwhile; ?> <?php endif; ?> </div>
Hi, did you find any use of my reply? 🙂
You must be logged in to reply to this topic.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.