Can WP Customizer work with single pages or posts?

Theme Customization API has been added in WP 3.4 and is described here: https://codex.wordpress.org/Theme_Customization_API

It makes it easy to add options such as “change background color” for themes. Such options will be stored in the database (in wp_options) with a name of your choice. You can then retrieve your value with get_option( 'field-name' );.

I’m wondering though if this works also with single posts or pages? So, is it possible to set different custom background color for each page with this tool and retrieve values using get_post_meta($id_of_the_current_post, 'field-name');?

3 Answers
3

That’s not exactly what the theme customizer is for. The theme customizer should be reserved for big (global) items. Like the background color of every page, not just a single page. There isn’t a way (that I know of) to change things on a per page basis.

For things that are page specific to the page/post, I’d recommend using the custom post meta. Here’s a pretty good example: http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/

Leave a Comment