[wp-trac] [WordPress Trac] #27993: Support for contexts in the Customizer
WordPress Trac
noreply at wordpress.org
Thu Jul 10 07:39:16 UTC 2014
#27993: Support for contexts in the Customizer
------------------------------+-----------------------------
Reporter: danielbachhuber | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.0
Component: Customize | Version:
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: ui, javascript
------------------------------+-----------------------------
Comment (by westonruter):
Replying to [comment:14 BFTrick]:
> Maybe this is a newb mistake but I did some testing and couldn't get
this to work. I applied the patch (I can see the updated source code
applied), and modified a TwentyFourteen control (screenshot:
http://cld.wthms.co/xG1I) with the `active_callback ` argument and no
matter where I go on the site via the customizer I still see the control.
>
> Am I doing something wrong here? Am I leaving something obvious out?
Humm, works for me. Now that it has been committed to core, can you try
again to see if your addition of the `active_callback` argument to the
`featured_content_layout` control has the desired effect? Perhaps there
was a problem with applying the patch.
I tried a similar test on the latest on trunk [29057], but used an
`active_callback`which returned a random `true`/`false` value. As
expected, the control expanded and collapsed randomly as I navigated
around the site in the customizer preview:
{{{#!diff
--- src/wp-content/themes/twentyfourteen/inc/customizer.php
+++ src/wp-content/themes/twentyfourteen/inc/customizer.php
@@ -54,6 +54,7 @@ function twentyfourteen_customize_register(
$wp_customize ) {
'grid' => __( 'Grid', 'twentyfourteen' ),
'slider' => __( 'Slider', 'twentyfourteen' ),
),
+ 'active_callback' => function () { return (bool) rand( 0,
1 ); },
) );
}
add_action( 'customize_register', 'twentyfourteen_customize_register' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27993#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list