2017-09-27 95 views
-3

我不知道PHP,但我必須在其中工作。我需要添加到$attr['ids']數組與$gallery_setting將數組屬性添加到implode()

function the_featured_image_gallery($atts = array()) { 

    $gallery_setting = get_theme_mod('featured_image_gallery'); 

    if (is_array($gallery_setting) && ! empty($gallery_setting)) { 
     $atts['ids'] = implode(',', $gallery_setting); 

     echo gallery_shortcode($atts); 
    } 
} 

理想情況下,我想:

echo gallery_shortcode($atts, array(
    'order'  => 'ASC', 
    'size'  => 'full', 
    'link'  => 'none' 
)); 

,但我知道,這是行不通的。

回答

0

請澄清一下您的問題。目前尚不清楚你的問題是什麼?

要嘗試在黑暗中拍攝:

function the_featured_image_gallery($atts = array()) { 

    $gallery_setting = get_theme_mod('featured_image_gallery'); 

    if (is_array($gallery_setting) && ! empty($gallery_setting)) { 
     $atts['ids'] = implode(',', $gallery_setting); 

     $additional_atts = array(
      'order'  => 'ASC', 
      'size'  => 'full', 
      'link'  => 'none' 
     );    
     $atts = array_merge($atts, $additional_atts); 

     echo gallery_shortcode($atts); 
    } 
} 
+0

謝謝,非常感謝) – BrooonS