Я пытаюсь добавить в конструктор сетки собственный шорткод. Шорткод работает как положено, но напечатанное значение пусто.
add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
function my_module_add_grid_shortcodes( $shortcodes ) {
$shortcodes['vc_custom_post_press_link'] = array(
'name' => __( 'Press link', 'domain' ),
'base' => 'vc_custom_post_press_link',
'category' => __( 'Content', 'my-text-domain' ),
'description' => __( 'Show custom post meta', 'my-text-domain' ),
'post_type' => Vc_Grid_Item_Editor::postType(),
);
return $shortcodes;
}
// output function
add_shortcode( 'vc_custom_post_press_link', 'vc_custom_post_press_link_render' );
function vc_custom_post_press_link_render($atts, $content, $tag) {
return 'test1 {{ press_link }}';
}
add_filter( 'vc_gitem_template_attribute_press_link', 'vc_gitem_template_attribute_press_link ', 10, 2 );
function vc_gitem_template_attribute_press_link( $value, $data ) {
return 'test2';
}
Ожидаемый результат должен быть
test1 test2
но я только получаю
test1
Исходный код взят из официального документа , но, похоже, он не работает.
EDIT:
Я только что попробовал и код в документации тоже не работает. Я думаю, это не обновляется. Мне нужен способ получить значение поля ACF и добавить немного HTML вокруг него.