Need GLOBAL var to detect "If Appearance Customize Screen" is ON
-
Problem:
When admin is using ‘Appearance Customize Screen’ via the theme sub menu Appearance->customize there appears to be no way to detect if “is_customiser” is true/false via the theme layer.Consider the following:
Lets say an Admin is customizing a site that has sub pages, they change a color within the customer section that only applies to a subpage. We have no way to preview that change on any other page other than the “homepage”.Possible solution:
create a boolean such as “is_customiser” where as we could easily include the additional layouts on the home page in a “preview detected mode”some tests and attempts:
I tried this in Functions.phpfunction mytheme_customizer_live_preview(){ global $_customiser; $_customiser = TRUE; //<- this works echo "bar"; //<- this works, but dumps prior to head } add_action( 'customize_preview_init', 'mytheme_customizer_live_preview' );
and then in header.php
global $_customiser; if( $_customiser){ echo "foo"; //<- this works}
And thats good and fine if I want to push a bunch of ODB into a var and have a really really long homepage…
However this becomes quite ineffective with lets say a 10 template and 5 custom post_type multi taxonomy site…Simply put: we need a way to accomplish any or all of the following
- A: better way to detect if the customizer is active…
and if so, then show things that are not on the homepage. - B: make the customizer work on subpages,
where as a user is in Appearance->customize and clicks on a subpage the customizer needs to know that and load options there too… - C: possibly create some new hook, or, allow us to feed information back to the customiser from inside our iFrame?
Please feel free to suggest alternatives, I have reviewed the documentation but maybe there is another way I do not know of?
thank you for your consideration and examination of this matter.
- A: better way to detect if the customizer is active…
- The topic ‘Need GLOBAL var to detect "If Appearance Customize Screen" is ON’ is closed to new replies.