Last active
September 26, 2017 08:13
Revisions
-
pavelthq revised this gist
Feb 16, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ function vc_gitem_template_attribute_post_custom_meta( $value, $data ) { $atts_extended = array(); parse_str( $data, $atts_extended ); $atts = $atts_extended['atts']; $output = print_r($atts, true); // will containt shortcode ATTS $output .= print_r($post->ID, true); // will contain current POST_ID $output .= print_r(get_post_meta($post->ID), true); // will contain current post meta.. -
pavelthq created this gist
Feb 16, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ add_filter( 'vc_gitem_template_attribute_post_custom_meta', 'vc_gitem_template_attribute_post_custom_meta', 10, 2 ); function vc_gitem_template_attribute_post_custom_meta( $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 ); $atts = $atts_exntended['atts']; $output = print_r($atts, true); // will containt shortcode ATTS $output .= print_r($post->ID, true); // will contain current POST_ID $output .= print_r(get_post_meta($post->ID), true); // will contain current post meta.. return $output; } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' ); function my_module_add_grid_shortcodes( $shortcodes ) { $shortcodes['vc_say_hello'] = array( 'name' => __( 'Say Hello', 'my-text-domain' ), 'base' => 'vc_say_hello', 'category' => __( 'Content', 'my-text-domain' ), 'description' => __( 'Just outputs Hello World', 'my-text-domain' ), 'post_type' => Vc_Grid_Item_Editor::postType(), ); return $shortcodes; } add_shortcode( 'vc_say_hello', 'vc_say_hello_render' ); function vc_say_hello_render($atts){ /** @var $atts array - shortcode attributes */ $atts = vc_map_get_attributes( 'vc_say_hello', $atts ); return '{{ post_custom_meta:' . http_build_query( array( 'atts' => $atts, ) ) . '}}'; }