我将 WPBackery 画廊的元素复制到一个新的简码中,以便在新的自定义页面中打印它。但是如何打印图像数组?
我如何知道将所有短代码带入 var_dump 的元素?
希望有人帮助我
编辑
我创建了一个新的简码以使其适应客户购买的模板。但是在所说的短代码中,我复制了 wpbakery 中已经默认提供的一个。在我的短代码中添加侧边栏、图片库和视频的选择,我想知道如何在与短代码对应的视图中打印该画廊和视频
这是我的简码
$bunch_sc['bunch_service_images_video'] = array(
"name" => __("Images and video", BUNCH_NAME),
"base" => "bunch_service_images_video",
"class" => "",
"category" => __('Mega Corp', BUNCH_NAME),
"icon" => 'fa-briefcase' ,
'description' => __('Show Images and video.', BUNCH_NAME),
"params" => array(
array(
'type' => 'dropdown',
'heading' => esc_html__( 'Choose Sidebar', BUNCH_NAME ),
"param_name" => 'sidebar_slug',
"value" => megacorp_bunch_get_sidebars( true ),
'description' => esc_html__( 'Choose Sidebar.', BUNCH_NAME ),
),
array(
'group' => 'image product',
'type' => 'dropdown',
'heading' => esc_html__( 'Gallery type', 'js_composer' ),
'param_name' => 'type',
'value' => array(
esc_html__( 'Flex slider fade', 'js_composer' ) => 'flexslider_fade',
esc_html__( 'Flex slider slide', 'js_composer' ) => 'flexslider_slide',
esc_html__( 'Nivo slider', 'js_composer' ) => 'nivo',
esc_html__( 'Image grid', 'js_composer' ) => 'image_grid',
),
'description' => esc_html__( 'Select gallery type.', 'js_composer' ),
),
array(
'group' => 'image product',
'type' => 'dropdown',
'heading' => esc_html__( 'Auto rotate', 'js_composer' ),
'param_name' => 'interval',
'value' => array(
3,
5,
10,
15,
esc_html__( 'Disable', 'js_composer' ) => 0,
),
'description' => esc_html__( 'Auto rotate slides each X seconds.', 'js_composer' ),
'dependency' => array(
'element' => 'type',
'value' => array(
'flexslider_fade',
'flexslider_slide',
'nivo',
),
),
),
array(
'group' => 'image product',
'type' => 'dropdown',
'heading' => esc_html__( 'Image source', 'js_composer' ),
'param_name' => 'source',
'value' => array(
esc_html__( 'Media library', 'js_composer' ) => 'media_library',
esc_html__( 'External links', 'js_composer' ) => 'external_link',
),
'std' => 'media_library',
'description' => esc_html__( 'Select image source.', 'js_composer' ),
),
array(
'group' => 'image product',
'type' => 'attach_images',
'heading' => esc_html__( 'Images', 'js_composer' ),
'param_name' => 'images',
'value' => '',
'description' => esc_html__( 'Select images from media library.', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'media_library',
),
),
array(
'group' => 'image product',
'type' => 'exploded_textarea_safe',
'heading' => esc_html__( 'External links', 'js_composer' ),
'param_name' => 'custom_srcs',
'description' => esc_html__( 'Enter external link for each gallery image (Note: divide links with linebreaks (Enter)).', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'external_link',
),
),
array(
'group' => 'image product',
'type' => 'textfield',
'heading' => esc_html__( 'Image size', 'js_composer' ),
'param_name' => 'img_size',
'value' => 'thumbnail',
'description' => esc_html__( 'Enter image size. Example: thumbnail, medium, large, full or other sizes defined by current theme. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use "thumbnail" size.', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'media_library',
),
),
array(
'group' => 'image product',
'type' => 'textfield',
'heading' => esc_html__( 'Image size', 'js_composer' ),
'param_name' => 'external_img_size',
'value' => '',
'description' => esc_html__( 'Enter image size in pixels. Example: 200x100 (Width x Height).', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'external_link',
),
),
array(
'group' => 'image product',
'type' => 'dropdown',
'heading' => esc_html__( 'On click action', 'js_composer' ),
'param_name' => 'onclick',
'value' => array(
esc_html__( 'None', 'js_composer' ) => '',
esc_html__( 'Link to large image', 'js_composer' ) => 'img_link_large',
esc_html__( 'Open prettyPhoto', 'js_composer' ) => 'link_image',
esc_html__( 'Open custom link', 'js_composer' ) => 'custom_link',
),
'description' => esc_html__( 'Select action for click action.', 'js_composer' ),
'std' => 'link_image',
),
array(
'group' => 'video',
'type' => 'textfield',
'heading' => esc_html__( 'Widget title', 'js_composer' ),
'param_name' => 'title',
'description' => esc_html__( 'Enter text used as widget title (Note: located above content element).', 'js_composer' ),
),
array(
'group' => 'video',
'type' => 'textfield',
'heading' => esc_html__( 'Video link', 'js_composer' ),
'param_name' => 'link',
'value' => 'https://vimeo.com/51589652',
'admin_label' => true,
'description' => sprintf( esc_html__( 'Enter link to video (Note: read more about available formats at WordPress %scodex page%s).', 'js_composer' ), '<a href="https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F" target="_blank">', '</a>' ),
),
array(
'group' => 'video',
'type' => 'dropdown',
'heading' => esc_html__( 'Video width', 'js_composer' ),
'param_name' => 'el_width',
'value' => array(
'100%' => '100',
'90%' => '90',
'80%' => '80',
'70%' => '70',
'60%' => '60',
'50%' => '50',
'40%' => '40',
'30%' => '30',
'20%' => '20',
'10%' => '10',
),
'description' => esc_html__( 'Select video width (percentage).', 'js_composer' ),
),
array(
'group' => 'video',
'type' => 'dropdown',
'heading' => esc_html__( 'Video aspect ration', 'js_composer' ),
'param_name' => 'el_aspect',
'value' => array(
'16:9' => '169',
'4:3' => '43',
'2.35:1' => '235',
),
'description' => esc_html__( 'Select video aspect ratio.', 'js_composer' ),
),
array(
'group' => 'brand logo',
'type' => 'dropdown',
'heading' => esc_html__( 'Gallery type', 'js_composer' ),
'param_name' => 'type',
'value' => array(
esc_html__( 'Flex slider fade', 'js_composer' ) => 'flexslider_fade',
esc_html__( 'Flex slider slide', 'js_composer' ) => 'flexslider_slide',
esc_html__( 'Nivo slider', 'js_composer' ) => 'nivo',
esc_html__( 'Image grid', 'js_composer' ) => 'image_grid',
),
'description' => esc_html__( 'Select gallery type.', 'js_composer' ),
),
array(
'group' => 'brand logo',
'type' => 'dropdown',
'heading' => esc_html__( 'Auto rotate', 'js_composer' ),
'param_name' => 'interval',
'value' => array(
3,
5,
10,
15,
esc_html__( 'Disable', 'js_composer' ) => 0,
),
'description' => esc_html__( 'Auto rotate slides each X seconds.', 'js_composer' ),
'dependency' => array(
'element' => 'type',
'value' => array(
'flexslider_fade',
'flexslider_slide',
'nivo',
)
)
),
array(
'group' => 'brand logo',
'type' => 'dropdown',
'heading' => esc_html__( 'Image source', 'js_composer' ),
'param_name' => 'source',
'value' => array(
esc_html__( 'Media library', 'js_composer' ) => 'media_library',
esc_html__( 'External links', 'js_composer' ) => 'external_link',
),
'std' => 'media_library',
'description' => esc_html__( 'Select image source.', 'js_composer' ),
),
array(
'group' => 'brand logo',
'type' => 'attach_images',
'heading' => esc_html__( 'Images', 'js_composer' ),
'param_name' => 'images',
'value' => '',
'description' => esc_html__( 'Select images from media library.', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'media_library',
),
),
array(
'group' => 'brand logo',
'type' => 'exploded_textarea_safe',
'heading' => esc_html__( 'External links', 'js_composer' ),
'param_name' => 'custom_srcs',
'description' => esc_html__( 'Enter external link for each gallery image (Note: divide links with linebreaks (Enter)).', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'external_link',
),
),
array(
'group' => 'brand logo',
'type' => 'textfield',
'heading' => esc_html__( 'Image size', 'js_composer' ),
'param_name' => 'img_size',
'value' => 'thumbnail',
'description' => esc_html__( 'Enter image size. Example: thumbnail, medium, large, full or other sizes defined by current theme. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use "thumbnail" size.', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'media_library',
),
),
array(
'group' => 'brand logo',
'type' => 'textfield',
'heading' => esc_html__( 'Image size', 'js_composer' ),
'param_name' => 'external_img_size',
'value' => '',
'description' => esc_html__( 'Enter image size in pixels. Example: 200x100 (Width x Height).', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'external_link',
),
),
array(
'group' => 'brand logo',
'type' => 'dropdown',
'heading' => esc_html__( 'On click action', 'js_composer' ),
'param_name' => 'onclick',
'value' => array(
esc_html__( 'None', 'js_composer' ) => '',
esc_html__( 'Link to large image', 'js_composer' ) => 'img_link_large',
esc_html__( 'Open prettyPhoto', 'js_composer' ) => 'link_image',
esc_html__( 'Open custom link', 'js_composer' ) => 'custom_link',
),
'description' => esc_html__( 'Select action for click action.', 'js_composer' ),
'std' => 'link_image',
),
)
);
在我的 service_images_video.php 中,我想打印图库和视频,但我想知道我需要如何使用或使用变量。
<?php
ob_start() ;
?>
<!-- start service-singel-section -->
<section class="service-singel-section section-padding">
<div class="container">
<div class="row">
<div class="col col-md-8 col-md-push-4">
<div class="service-single-content">
<div>
<img src="<?php echo esc_url(wp_get_attachment_url($ser_img)); ?>" alt>
</div>
<div class="title">
<div class="download">
<a href="<?php echo esc_url($pdf_link); ?>"><i class="fa fa-file-pdf-o"></i> <?php echo wp_kses_post($pdf_title); ?></a>
</div>
</div>
<br>
<br>
<div class="details">
<p><?php echowp_get_attachment_image_src( $image_id, 'full' );; ?></p>
</div>
</div> <!-- end service content -->
</div> <!-- end col -->
<div class="col col-md-4 col-md-pull-8">
<div class="service-single-sidebar">
<?php if ( is_active_sidebar( $sidebar_slug ) ) : ?>
<?php dynamic_sidebar( $sidebar_slug ); ?>
<?php endif; ?>
</div>
</div>
</div> <!-- end row -->
</div> <!-- end container -->
</section>
<!-- end service-single-section -->
<?php
$output = ob_get_contents();
ob_end_clean();
return $output ; ?>