WordPress.org

Ready to get started?Download WordPress

Forums

Get Alt and insert into my theme (2 posts)

  1. titama
    Member
    Posted 1 year ago #

    Hi!

    I'have a probleme, i'm new on wordpress and I don't arrive to add the alt attribut and the other title and caption. I try many thinks like
    $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
    but nothing works for me, somebody can help me?

    I have this code on my theme:

    add_shortcode('flex_slider','wpts_flex_slider');
    	$string = '';
    	function wpts_flex_slider_item($atts, $content = null, $code)
    	{
    		extract(shortcode_atts( array(
    			'src' => '',
    			'caption' => '',
    			'href' => '',
    			'alt'  => '',
    		), $atts));
    		$hclose = '';
    		if($href!= '')
    		{
    			$href = '<a href="'.$href.'">';
    			$hclose = '</a>';
    		}
    
    		$html = '
    		<li>
    			'.$href.'<img src="'.$src.'" alt="'.$alt.'" />'.$hclose.'
    
    		</li>';
    		return $html;
    	}
  2. titama
    Member
    Posted 1 year ago #


Topic Closed

This topic has been closed to new replies.

About this Topic