Skip to main content
added 234 characters in body
Source Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested! You get the current active sidebar with key( $GLOBALS['wp_registered_sidebars'] ).

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr( $widget ) { static $counter = 0; // right sidebar in Twenty Ten. Adjust to your needs. if ( 'primary-widget-area' !== key( $GLOBALS['wp_registered_sidebars'] ) )   return; if ( 0 !== $counter && 0 === $counter % 3 ) echoprint '<hr>'; $counter += 1; } 

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested!

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr() { static $counter = 0; if ( 0 !== $counter && 0 === $counter % 3 ) echo '<hr>'; $counter += 1; } 

Hook into 'dynamic_sidebar' and count how often it is called.

You get the current active sidebar with key( $GLOBALS['wp_registered_sidebars'] ).

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr( $widget ) { static $counter = 0; // right sidebar in Twenty Ten. Adjust to your needs. if ( 'primary-widget-area' !== key( $GLOBALS['wp_registered_sidebars'] ) )   return; if ( 0 !== $counter && 0 === $counter % 3 ) print '<hr>'; $counter += 1; } 
edited body
Source Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested!

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr() { static $counter = 1;0; if ( 0 !== $counter && 0 === $counter % 3 ) echo '<hr>'; $counter += 1; } 

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested!

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr() { static $counter = 1; if ( 0 === $counter % 3 ) echo '<hr>'; $counter += 1; } 

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested!

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr() { static $counter = 0; if ( 0 !== $counter && 0 === $counter % 3 ) echo '<hr>'; $counter += 1; } 
Source Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463

Hook into 'dynamic_sidebar' and count how often it is called.

Not tested!

add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr() { static $counter = 1; if ( 0 === $counter % 3 ) echo '<hr>'; $counter += 1; }