render Visual Composer shortcodes onto page

I am trying to echo visual composer shortcodes onto a page.

I’ve tried both methods below, but they don’t work:

functions.php:

Method 1

/*
 * add shortcode file
 */
function include_file($atts) {
    $a = shortcode_atts( array(
        'slug' => 'NULL',
    ), $atts );

    if($slug != 'NULL'){
        ob_start();
        get_template_part($a['slug']);
        return ob_get_clean();
    }
}
add_shortcode('include', 'include_file');

Method 2

function someshortocode_callback( $atts = array(), $content = null ) {

    $output = "[vc_section full_width=\"stretch_row\" css=\".vc_custom_1499155244783{padding-top: 8vh !important;padding-bottom: 5vh !important;background-color: #f7f7f7 !important;}\"][vc_row 0=\"\"][vc_column offset=\"vc_col-lg-offset-3 vc_col-lg-6 vc_col-md-offset-3 vc_col-md-6\"][/vc_column][/vc_row][/vc_section]";
    return $output;
}
add_shortcode('someshortocode', 'someshortocode_callback');

file_rendering_vc_shortcodes.php:

Method 1

<?php if ( is_plugin_active( 'js_composer/js_composer.php' ) ) {
	wc_print_notice('js_composer plugin ACTIVE', 'notice');
    echo do_shortcode('[include slug="vc_templates/shop-page"]');
}; ?>

Result

  • js_composer plugin ACTIVE
  • shortcode is on page with parentheses as is

Method 2

<?php $post = get_post();

if ( $post && preg_match( '/vc_row/', $post->post_content ) ) {
// Visual composer works on current page/post
    wc_print_notice('VC ON', 'notice');
    echo add_shortcode('someshortocode', 'someshortocode_callback');
} else {
    wc_print_notice('VC OFF', 'notice');
    //echo do_shortcode('[include slug="vc_templates/shop-page"]');
}; ?>

Result

  • VC OFF (obviously, since the vc_row in shortcode is not there)
  • shortcode is NOT on page

shop-page.php

<?php
/**
Template Name:  Shop Page in theme
Preview Image:  #
Descriptions:   #
 * [vc_row][vc_column][/vc_column][/vc_row]
 */
?>
[vc_section full_width="stretch_row" css=".vc_custom_1499155244783{padding-top: 8vh !important;padding-bottom: 5vh !important;background-color: #f7f7f7 !important;}"][vc_row 0=""][vc_column offset="vc_col-lg-offset-3 vc_col-lg-6 vc_col-md-offset-3 vc_col-md-6"][/vc_column][/vc_row][/vc_section]

Is it possible to render vc shortcodes on page, and if so, how is it done?