Presenting Post MetaData inside WP Bakery Grids

Grids are great for templating

But, out of box, they don’t always include what you need. In this instance, we’ve got a button that is rendered via the vc_external_link[] – this can be placed inside the grid builder on the back-end.

add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
function my_module_add_grid_shortcodes( $shortcodes ) {
$shortcodes['vc_external_link'] = array(
'name' => __( 'External Link', 'my-text-domain' ),
'base' => 'vc_external_link',
'category' => __( 'Content', 'my-text-domain' ),
'description' => __( 'Outputs custom link from post', 'my-text-domain' ),
'post_type' => Vc_Grid_Item_Editor::postType(),
);
return $shortcodes;
}

function makeButton(){
return ‘<div class=”vc_btn3-container vc_btn3-center la-vc-btn”><a class=”vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-rounded vc_btn3-style-modern vc_btn3-block vc_btn3-icon-left vc_btn3-color-success” a=”” href=”‘.'{{ post_data:link }}’.'” title=”View More”><i class=”vc_btn3-icon fas fa-external-link-alt”></i> View More</a></div>’;
}

add_shortcode( ‘vc_external_link’, ‘vc_external_link_render’ );
function vc_external_link_render() {

return makeButton();
}

 

Share This Article :

Related Posts