将数组属性添加到 implode()
Add array attributes to implode()
我不知道PHP,但我必须在其中工作。我需要使用 $gallery_setting
.
添加到 $attr['ids']
数组
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'
) );
但我知道这是行不通的。
请澄清您的问题。不清楚你的问题是什么...
尝试在黑暗中拍摄:
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 );
}
}
我不知道PHP,但我必须在其中工作。我需要使用 $gallery_setting
.
$attr['ids']
数组
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'
) );
但我知道这是行不通的。
请澄清您的问题。不清楚你的问题是什么...
尝试在黑暗中拍摄:
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 );
}
}