Created
February 16, 2016 13:41
-
-
Save pavelthq/5f8b811fe4e161d6d286 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' ); | |
function my_module_add_grid_shortcodes( $shortcodes ) { | |
$shortcodes['vc_post_content'] = array( | |
'name' => __( 'Post content', 'fluidtopics' ), | |
'base' => 'vc_post_content', | |
'category' => __( 'Content', 'fluidtopics' ), | |
'description' => __( 'Show current post content', 'fluidtopics' ), | |
'post_type' => Vc_Grid_Item_Editor::postType(), | |
); | |
return $shortcodes; | |
} | |
add_shortcode( 'vc_post_content', 'vc_post_content_render' ); | |
function vc_post_content_render() { | |
return '{{ do_shortcode_post_content }}'; | |
} | |
add_filter( 'vc_gitem_template_attribute_do_shortcode_post_content', 'vc_gitem_template_attribute_do_shortcode_post_content', 10, 2 ); | |
function vc_gitem_template_attribute_do_shortcode_post_content( $value, $data ) { | |
/** | |
* @var null|Wp_Post $post ; | |
* @var string $data ; | |
*/ | |
extract( array_merge( array( | |
'post' => null, | |
'data' => '', | |
), $data ) ); | |
$atts_extended = array(); | |
parse_str( $data, $atts_extended ); | |
WPBMap::addAllMappedShortcodes(); | |
$output = do_shortcode( $post->post_content ); | |
ob_start(); | |
do_action( 'wp_enqueue_scripts' ); | |
wp_print_styles(); | |
wp_print_scripts(); | |
wp_print_footer_scripts(); | |
$output .= ob_get_clean(); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot AngeIII, it works very well. That's all what I needed.
Do you plan to integrate it in a next update or will it be only documented ?