php - Pass value into widgets in wordpress -
so want add together widget area in sidebar, resizes widgets depending on how many widgets active. like, if there 3 active widgets, each 1 33% width of container.
my widget set :
register_sidebar(array( 'name' => __( 'front page widgets' ), 'id' => 'front-page', 'description' => __( 'widgets in area appear on front end page.' ), 'before_widget' =>'<li class="span4">', 'before_title' => '<h3>', 'after_title' => '</h3>' ));
i can count number of active widgets this
$sidebars = wp_get_sidebars_widgets(); $footerwidgetcount = count( $sidebars['footer-widgets'] );
but how go passing $footerwidgetcount widget? id able pass new value before_widget
resize on fly. possible?
if i'm understanding correctly:
$data = array( 'name' => __( 'front page widgets' ), 'id' => 'front-page', 'description' => __( 'widgets in area appear on front end page.' ), 'before_widget' =>'<li class="span4">', 'before_title' => '<h3>', 'after_title' => '</h3>' ); $data['before_widget'] = "<li class='span$footerwidgetcount'>"; register_sidebar($data);
php wordpress
No comments:
Post a Comment