Skip to content

Instantly share code, notes, and snippets.

@cgrymala
Created July 13, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgrymala/b2a701ef8f88e32c8644 to your computer and use it in GitHub Desktop.
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"
<?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