-1

I copy the element of the gallery of WPBackery in a new shortcode to print it in a new customa page. but how can I print the array of images?

how can I know the elements that bring all the shortcode with a var_dump?

hope someone help me

edit

I create a new Shortcode to adapt it to the template my customer bought. But in said shortcode, I copied one of the ones that already come by default in wpbakery. In my short code add selection of a side bar, image gallery and a video, I want to know how I can print that gallery and video, in the view corresponding to the short code

this is my shortcode

$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',
                ),
            )
        );

in my service_images_video.php i want to print the gallery and the video but i want to know how or with variables i need to use.

<?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 ; ?>
cesg.dav
  • 320
  • 1
  • 14

1 Answers1

0

You need to install a kint debugging plugin, I recommend reading this article for you

Then use it to view variables, example:

function myshortcode($attrs, $content = null) {
  d($attrs);
}
add_shortcode('myshortcode', 'myshortcode');

If I create this shortcode: (I will insert into the page and save it)

[myshortcode test="1"]

Then I get this on client side:

enter image description here

Unbywyd
  • 856
  • 1
  • 4
  • 8