Я пытаюсь вывести теги записей в построителе пользовательских сеток, он позволяет выводить значения пользовательских метаполей по ключам, но не позволяет использовать простые теги wp. Я пытался следовать инструкциям , и вот мой код, который добавил шорткод, но все еще не выводит никаких тегов
add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
function my_module_add_grid_shortcodes( $shortcodes ) {
$shortcodes['vc_mytags'] = array(
'name' => __( 'My Tags', 'my-text-domain' ),
'base' => 'vc_mytags',
'category' => __( 'Post', 'my-text-domain' ),
'description' => __( 'Show post tags', 'my-text-domain' ),
'post_type' => Vc_Grid_Item_Editor::postType(),
);
return $shortcodes;
}
// output function
add_shortcode( 'vc_mytags', 'vc_mytags_render' );
function vc_mytags_render($atts, $content, $tag) {
return '{{ mytags }}';
}
add_filter( 'vc_gitem_template_attribute_mytags', 'vc_gitem_template_attribute_mytags ', 10, 2 );
function vc_gitem_template_attribute_mytags( $value, $data ) {
/**
* @var Wp_Post $post
* @var string $data
*/
extract( array_merge( array(
'post' => null,
'data' => '',
), $data ) );
return var_export( get_the_tag_list('<p>Tags: ',', ','</p>'));
}
Что не так?