php - last class to every third widget -


I'm trying to add the last category to every third widget. But with this function, I can just add the "last" category to the previous widget.

  function widget_ last_classes ($ params) {global $ widget_num; $ This_id = $ params [0] ['id']; $ Arr_registered_widgets = wp_get_sidebars_widgets (); If (! $ Widget_num) {$ widget_num = array (); } If (! Isset ($ arr_registered_widgets [$ this_id]) || is_array ($ arr_registered_widgets [$ this_id])) Return $ $ params; } If (isset ($ widget_num [$ this_id])) {$ widget_num [$ this_id] ++; } And {$ widget_num [$ this_id] = 1; } $ Class = 'class =' ​​'; If $ $ _ ($ arr_registered_widgets [$ this_id])) $ {$ class = 'last' / ',' $ Square ', $ params [0] [' before_widget '], 1); return $ params;} Add_filter (' dynamic_sidebar_params', 'widget_last_classes');    

change = if ($ widget_num [$ this_id] == count ($ arr_registered_widgets [$ this_id])) {< > With if (($ widget_num [$ this_id]% 3) == 0} {

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -