How can I tell the customizer to only load certain customizer options based on the post type that is being previewed?
i.e. using:
is_woocommerce
is_shop
is_cart
etc.
When adding customizer option fields, I can check to ensure woocommerce is in the "active_plugins" array so those options are only provided if woocommerce is installed and active, however I need to find a way to only load those fields into the customizer when actually viewing a shop, product, cart, etc. type page.
My only workaround for now is using js/css to show/hide the fields but optimally when navigating among pages in the customizer preview, and since each gets a full refresh anyway, it would be much leaner to dynamically load those options only when necessary based on the post_type being previewed.
active_callback
parameter. See make.wordpress.org/core/2014/07/08/… for examples (look at the "Contextual Controls" section).