Вы можете легко вызвать значения wpcf с помощью post.get_field().
Ex:
{{post.get_field('wpcf-ticket-url')}}
Кроме того, вы можете создавать любые вспомогательные функции для расширения вашей библиотеки прут. Вы можете назначить их в файле functions.php в папке темы твиг.
Ex:
веточка-тема/functions.php:
$context['get_custom_meta'] = TimberHelper::function_wrapper('get_custom_meta', array('',0));//array contains default values
function get_custom_meta($key,$id){
if(empty($id)){
return types_render_field($key, array("raw"=>"true","separator"=>";"));
}else{
return get_post_meta($id, 'wpcf-'.$key, true);
}
}
веточка-тема/просмотров/xxx.twig:
сделал вы пробовали 'get_post_meta ('post_id', 'custom_field', true); '? –
Мои файлы .twig, поэтому php-коды не работают. Спасибо хоть! – tine