Hi Adriano,
the functions.php code:
function slider_output($atts) { extract( shortcode_atts( array( 'img' => '', ), $atts ) ); global $post, $wpdb; $images = get_post_meta($post->ID, $img, false); $out = ''; foreach ($images as $image) { $attachment_id = $wpdb->get_var($wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid = %s", $image )); $image_title = get_the_title($attachment_id); $thumb = wp_get_attachment_image_src( $attachment_id, ('slider-image') ); $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); $out .= '<img itemprop="image" src="' . $thumb[0]. '" alt="' . $alt . '" />'; } $out .= ''; return $out; } add_shortcode('slider-output', 'slider_output');
I work local so there is no image url I can provide. The view get the image via [slider-output img="wpcf-intro-slider-top"] (image field).
Output is:
<img itemprop="image" src="/cod_black_ops_2_vengeance-710x411.jpg" alt="cod black ops 2 vengeance 710x411 Call of Duty: Black Ops 2" title="Call of Duty: Black Ops 2" />
So TITLE tag was added on some point and ALT tag was replaced.