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
Hi
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:
https://www.advancedcustomfields.com/resources/has_sub_field/
have_rows was added in 4.3.0:
https://www.advancedcustomfields.com/resources/have_rows/
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:
https://s18.postimg.org/u40izazd5/Radiology_24_Hour_Emergency_Services.png
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
or sidebar.php
thanks
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>
The topic ‘image Alt Text Issue’ 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.