-
Hi there,
I’m here again to try to resolve this “problem”.
In the past I asked your support for the same question, and it looks I was able to fix it, but now I realize that I did not.
Please may you help me? I spended all the day trying to insert the ALT tag in post featured images, but I’m don’t know php language and I failed 1000 times
In my old post you said:
Yes, you need to edit your index.php and single.php templates, then find all occurences of “wp_get_attachment_image_src”
Then add the params for the alt tabs as described here:http://codex.wordpress.org/Function_Reference/wp_get_attachment_image
Then add the alt attribute to the image below.
I tried to edit the files index.php and single.php, but no success…
Below is just a part of the code that I need to edit… How to add the params for the alt tab?<?php // IF Post type is Standard (false) if(function_exists( 'get_post_format' ) && get_post_format( $post->ID ) != 'gallery' && get_post_format( $post->ID ) != 'video' && has_post_thumbnail()) { $thumbbig = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'portfolio-full' ); $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'portfolio-main'); ?> <div class="pic"> <a href="<?php echo $thumbbig[0];?>" rel="prettyPhoto" title="<?php echo $post->post_title; ?>"> <img src="<?php echo $attachment_image[0];?>" /><div class="img_overlay_zoom"></div> </a> </div> <div class="h20"></div> <?php } // IF Post type is Standard :: END ?> <?php // IF Post type is Gallery if (( function_exists( 'get_post_format' ) && get_post_format( $post->ID ) == 'gallery' )) { $args = array( 'numberposts' => -1, // Using -1 loads all posts 'orderby' => 'menu_order', // This ensures images are in the order set in the page media manager 'order'=> 'ASC', 'post_mime_type' => 'image', // Make sure it doesn't pull other resources, like videos 'post_parent' => $post->ID, // Important part - ensures the associated images are loaded 'post_status' => null, 'post_type' => 'attachment' ); $images = get_children( $args ); if($images){ ?> <div class="flexslider"> <ul class="slides"> <?php foreach($images as $image){ $attachment = wp_get_attachment_image_src($image->ID, 'portfolio-full'); $thumb = wp_get_attachment_image_src($image->ID, 'portfolio-main'); ?> <li class="pic"> <a href="<?php echo $attachment[0] ?>" rel="prettyPhoto[gallery]" title="<?php echo $image->post_title; ?>" > <img src="<?php echo $thumb[0] ?>" /><div class="img_overlay_zoom"></div> </a> </li> <?php } ?> </ul> </div>I hope you can help me, alt tag is important for SEO…
Ciao.
Enrico
- Theme support is offered to verified customers only. To post a topic go to your Theme Category and add your question at the page bottom.
Theme Categories
Recent Topics
- Alea updates
- Why "Fortune" theme is no longer available?
- PHP 8.1 Error
- Issue with WPB editor icons
- Issue with Icons and Text Alignment for Arabic Content
- Installing and Activating Plugin Fortuna Portfolio CPT (1/8)
- Testimonials page is blank
- warning boc_framework line 905
- Transparent header issue without changes
- Slider Revolution error