Override post template settings

Posted in: Newspaper
Post count: 3

Hello, i use the default template for my posts but for the next month i want the posts of a specific category to use another template (post_template_1), tried to override the default template editing td_single_template_vars.php like you can see below with no luck.


//added by Radu A. check if this post have a post template to be display with.
//if not use the default site post template from Theme Panel -> Post Settings -> Default site post template
$td_default_site_post_template = td_util::get_option('td_default_site_post_template');

if(empty($td_post_theme_settings['td_post_template']) and !empty($td_default_site_post_template)) {
$td_post_theme_settings['td_post_template'] = $td_default_site_post_template;
}

$theid = $post->ID;
$catslugs = array('paidi','paideia','paidopsixologia','paixnidi','ygeia-diatrofi-paidi');

if (in_category($catslugs,$theid) ) {
$td_post_theme_settings['td_post_template'] = 'single_template_1';
$td_default_site_post_template = 'single_template_1';
}

Note that i tested in_category function and it returns true, any ideas?

Thank you

Post count: 3

Sorry to bump but it’s for advertising purpose and my client is kind of hurry.

Have a nice day 🙂

Post count: 6600

Hi,

The template is loaded using a hook in the td_wp_booster_functions.php file. That’s here you will need to make your changes. Here is an exmaple http://screencast.com/t/HpJAUc1iI

$theid = $post->ID;
$catslugs = array('featured');
if (in_category($catslugs,$theid) ) {
$single_template_id = 'single_template_1';
}

If you still need customizations on this and you can’t manage on your own please turn to a freelancer.

Thanks for the message!

Post count: 3

It works! thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.