• Resolved AleCss

    (@alecss)


    Hi, I’m editing the grid builder of visual composer to show one of the featured images uploaded with your plugin, the featured image 3.

    I have upload correctly featured images 3 and then I have added the filter as the visual composer documentation shows:

    add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
    function my_module_add_grid_shortcodes( $shortcodes ) {
       $shortcodes['kdmfi_the_featured_image'] = array(
            'name' => __( 'Logo negozio', 'js_composer' ),
            'base' => 'kdmfi_the_featured_image',
            'icon' => 'vc_icon-vc-gitem-image',
            'category' => __( 'Content', 'js_composer' ),
            'description' => __( 'Logo negozio', 'js_composer' ),
            'post_type' => Vc_Grid_Item_Editor::postType('negozi-millennium'),
        );
        return $shortcodes;
    }
     
    add_shortcode( 'kdmfi_the_featured_image', 'kdmfi_the_featured_image_render' );
    function kdmfi_the_featured_image_render() {
       return kdmfi_the_featured_image('featured-image-3' , 'full');
    }

    But the featured image 3 is not visible.

    My problem is in the final function add_shortcode: in the final return what do I have to insert to recall the featured images 3?

    I hope you can help me, thanks very much.

    Alex

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marcus Kober

    (@marcuskober)

    Hi there,

    please try to adjust your code as following:

    add_shortcode( 'kdmfi_the_featured_image', 'kdmfi_the_featured_image_render' );
    function kdmfi_the_featured_image_render() {
       return kdmfi_get_the_featured_image('featured-image-3' , 'full');
    }

    kdmfi_the_featured_image() outputs the image html directly, kdmfi_get_the_featured_image returns it.

    Regards,
    Marcus

    It appears that the function is called
    kdmfi_get_featured_image()
    NOT
    kdmfi_get_the_featured_image()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Retrieve featured image 3’ is closed to new replies.