Black Friday Sale! Get up to $40 off GP Premium!Learn more

Reply To: Set a page template to use sections?

Home Forums Support Set a page template to use sections? Reply To: Set a page template to use sections?

#187076
Katie Jones

Hi Tom,

This is what I’m using (below), it isn’t working yet. I’m adding the same exact meta that is added when I manually set “use sections” to “yes”, and yet “use sections” displays “no” on the front end when I add the meta programmatically. There must be something else to it – any ideas?

Thanks,
Katie

====

function zs_set_sections($post_id, $post, $update) {

$template = get_post_meta($post_id, “_wp_page_template”, true);
if($template == “tmpl_landing.php”) {
add_post_meta($post_id, “_generate_use_sections”, ‘a:1:{s:12:”use_sections”;s:4:”true”;}’, true);
}

}
add_action( ‘save_post’, ‘zs_set_sections’, 10000, 3 );