2013-05-16 16 views
0

想爲FlexSlider添加一個標題,該標題集成到了購買的Wordpress Organictheme中。我相信幻燈片頁面代碼必須修改,儘管我在這裏發現了一些類似的問題,但我還沒有想出(在很多小時和失敗的嘗試之後)在現有代碼中何處添加和究竟要添加什麼。看起來像標題應該是一個明智的選擇!似乎他們應該以某種方式包含在在Wordpress Organictheme上爲集成FlexSlider添加標題。

  • 標籤???真的會感謝一些幫助。 HTML,但不是PHP識字。謝謝!

    代碼需要的地方去這裏:

      <div class="flexslider"> 
    
           <ul class="slides"> 
    
            <?php $data = array(
             'post_parent'  => $post->ID, 
             'post_type'   => 'attachment', 
             'post_mime_type' => 'image', 
             'order'    => 'ASC', 
             'orderby'   => 'menu_order', 
             'numberposts'  => -1 
            ); ?> 
    
            <?php 
            $images = get_posts($data); foreach($images as $image) { 
             $imageurl = wp_get_attachment_url($image->ID);    echo '<li><img src="'.$imageurl.'" /></li>' . "\n"; 
            } ?> 
    
           </ul> 
    
          </div> 
    

    回答

    0

    你非常接近,確實如此。

    我會在別人需要時回答這個問題。代碼兩名失蹤位是:

    <p class="flex-caption"><?php echo $caption; ?></p> 
    

    ...通過flexslider顯示字幕必需的,

    $caption = $image->post_excerpt; 
    

    ...以實際獲取的字幕。新代碼將是:

     <div class="flexslider"> 
    
          <ul class="slides"> 
    
           <?php $data = array(
            'post_parent'  => $post->ID, 
            'post_type'   => 'attachment', 
            'post_mime_type' => 'image', 
            'order'    => 'ASC', 
            'orderby'   => 'menu_order', 
            'numberposts'  => -1 
           ); ?> 
    
           <?php 
           $images = get_posts($data); 
           foreach($images as $image) { 
            $imageurl = wp_get_attachment_url($image->ID); 
            $caption = $image->post_excerpt; 
            echo '<li><img src="'.$imageurl.'" /><p class="flex-caption">'.$caption.'</p></li>' . "\n"; 
           } ?> 
    
          </ul> 
    
         </div>