2011-06-08 184 views
1

我試圖將標題添加到wordpress中的圖片標題標籤,所以我使用的lightbox顯示標題,因爲它顯示的全部是標題標籤。我已經添加了$ caption以及從標題shortcode中借用的許多其他變體。有什麼建議麼?在wordpress中爲圖片標題標籤添加標題

function get_image_tag($id, $alt, $title, $align, $caption, $size='medium') { 

    list($img_src, $width, $height) = image_downsize($id, $size); 
    $hwstring = image_hwstring($width); 


    $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id; 
    $class = apply_filters('get_image_tag_class', $class, $id, $align, $size); 

    $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title=" ' . esc_attr($title).' | '. esc_attr($content).'" '.$hwstring.'class="'.$class.'" />'; 

    $html = apply_filters('get_image_tag', $html, $id, $alt, $title, $align, $caption, $size); 

    return $html; 
} 
+0

你使用的是什麼燈箱嗎? – 2011-06-08 21:22:19

+0

你是寫這個函數還是隻是修改它? '$ caption'參數來自哪裏? – Kyle 2011-06-08 21:47:03

+0

這個問題可以轉移到http://wordpress.stackexchange.com/嗎? – hakre 2011-06-08 21:48:21

回答

0
To add caption to the images being displayed in lightbox.Follow the below steps: 


- Go to admin dashboard and click the library,it will list out all uploaded 
    pictures used for lightbox.Then click on the image for which you want to give caption 
    Then,that image properties will appear in that caption field is there. 
           [OR] 

- You can include caption while adding image itself.For that click the media tab -> add 
    new.Upload New Media will open,in that click select files and load the image from your 
    local machine.After the image is uploaded.Below that image you will see the caption 
    property.