Contextual Customizer Option

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Contextual Customizer Option

Lox-2
Hello,

I need some contextual options in the customizer (related to the current
post in view)
Displaying a contextual panel/section/control is straight forward, but I
have issues saving/getting the option data from post metas.

My example is as simple as providing a page template dropdown for pages
(getting the control to display isn't the issue)

<?php

function customize_save_page_template ($value) {
    return update_post_meta( get_queried_object_id(), '_wp_page_template',
$value );
}
add_action( 'customize_save_page_template', 'customize_save_page_template');

function customize_update_page_template ($value) {
    return update_post_meta( get_queried_object_id(), '_wp_page_template',
$value );
}
add_action( 'customize_update_page_template',
'customize_update_page_template');

function customize_value_page_template ($default) {
    return get_post_meta( get_queried_object_id(), '_wp_page_template',
true );
}
add_action( 'customize_value_page_template',
'customize_value_page_template');

None of those work: it seems the customizer isn't aware of the current post
ID.

Any idea ?

Regards.

--
Lox
[hidden email]
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers