Created
July 13, 2015 14:07
-
-
Save cgrymala/b2a701ef8f88e32c8644 to your computer and use it in GitHub Desktop.
Modify Collapsible Widget Area arguments to use "content" height style instead of "auto"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sets the heightStyle argument for all accordion widget areas | |
* @see http://api.jqueryui.com/accordion/#option-heightStyle | |
*/ | |
add_filter( 'collapsible-widget-javascript-arguments', 'my_theme_modify_cwa_js_args' ); | |
function my_theme_modify_cwa_js_args( $args = array() ) { | |
/** | |
* Loop through all of the existing Collapsible Widget Areas | |
*/ | |
foreach ( $args as $k=>$a ) { | |
/** | |
* Check to see if this is an 'accordion' area or a 'tabbed' area | |
*/ | |
if ( 'accordion' == $a['type'] ) { | |
/** | |
* Set the appropriate jQueryUI accordion argument to the desired value | |
*/ | |
$args[$k]['heightStyle'] = 'content'; | |
} | |
} | |
/** | |
* Be certain to return the modified array, otherwise nothing will happen | |
*/ | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment