slug_widget_order_class

The Carbon Light - Business responsive slug widget order class function.

Description

slug_widget_order_class(); 

Usage

  1. if ( !function_exists( 'slug_widget_order_class' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = slug_widget_order_class(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function slug_widget_order_class() { 
  2. global $wp_registered_sidebars, $wp_registered_widgets; 
  3. $sidebars = wp_get_sidebars_widgets(); 
  4. if ( empty( $sidebars ) ) return; 
  5. foreach ( $sidebars as $sidebar_id => $widgets ) { 
  6. if ( empty( $widgets ) ) 
  7. continue; 
  8. $number_of_widgets = count( $widgets ); 
  9. foreach ( $widgets as $i => $widget_id ) { 
  10. $wp_registered_widgets[$widget_id]['classname'] .= ' widget-order-' . $i; 
  11. if ( $number_of_widgets == ( $i + 1 ) ) { 
  12. $wp_registered_widgets[$widget_id]['classname'] .= ' end';