add_filter('get_post_metadata', 'sht_template_filter', 1, 4);
function sht_template_filter($dummy, $post_id, $meta_key, $single, $category) {
if ( is_singular('post') and $meta_key == '_views_template' and $category == 'news-t2' ) { //Check the slug for Новости-t2 , then we are viewing a single post ( NEWS ) type
if ( is_recognized() )
{ return 1367; }
}
else { return null; } // In other case, we return null, which means the content won't be modified
}
Hello. Thank you for contacting the Toolset support.
Well - Toolset offers the filter "wpv_filter_force_template" that you can use to dynamically assign the content template you want to assign:
For example:
//Show a specific Content Template applied to a given post for not logged in visitors and in every place where this post appears:
add_filter( 'wpv_filter_force_template', 'prefix_fixed_content_for_visitors', 99, 3 );
function prefix_fixed_content_for_visitors( $template_selected, $id, $kind ) {
if ( !is_user_logged_in() && $id == 345 ) { // if the user is not logged in and is trying to view the post with ID 345
$template_selected = 123; // assign a fixed Content Template with ID 123
}
return $template_selected;
}