Hi,
Something like that cannot be done at the moment, as far as I know an option like this is considered for implementation in a future update. But at the moment a post template can only be set per post or for all posts at once if this option is selected in the post edit screen – http://prntscr.com/mwrjmb
Sorry for the inconvenience.
Thanks
I have the solution for the problem, is a little ”handmade” but it works.
you have to edit the function get_post_meta_array in \includes\wp_booster\td_util.php row 1540 whit this enhanced function:
static function get_post_meta_array($post_id, $key) {
$lookat=array(
//id_category=>"single_template_xx"
2247=>"single_template_3",
4360=>"single_template_10"
);
$post_meta = get_post_meta($post_id, $key, true);
$category = get_the_category($post_id)[0];
$first_category = $category->term_id;
if (!is_array($post_meta)&&!isset($lookat[$first_category])) {
$post_meta=array();
return $post_meta;
}elseif(!is_array($post_meta)&&isset($lookat[$first_category])){
$post_meta=array();
$post_meta["td_post_template"]=$lookat[$first_category];
return $post_meta;
}
return $post_meta;
}
You have to populate the array with the association category_id -> post_template, the variables are single_template_1 to single_template_13.
Custom post settings will be maintained.
Hope to be useful
The code was a mess 🙂
static function get_post_meta_array($post_id, $key) {
$lookat=array(
2247=>"single_template_3",
4360=>"single_template_10"
);
$post_meta = get_post_meta($post_id, $key, true);
$category = get_the_category($post_id)[0];
$first_category = $category->term_id;
if (!is_array($post_meta)&&!isset($lookat[$first_category])) {
$post_meta=array();
return $post_meta;
}elseif(!is_array($post_meta)&&isset($lookat[$first_category])){
$post_meta=array();
$post_meta["td_post_template"]=$lookat[$first_category];
return $post_meta;
}
return $post_meta;
}
