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;
}
Related Posts:
- Text Widget creates a
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- Add div class to only one widget
- What is the use case for the “Class” parameter in register_sidebar?
- How to avoid widgets added to sidebar on theme activation?
- Why do none of my widgets have a title?
- Widget area inside a widget
- More flexible sidebar and widget management
- WordPress widget new instance creates content duplicates
- duplicate sidebar
- Removing custom widget area WordPress 4.4 [closed]
- Insert Widget option into mark-up with register_sidebar
- Widgets not expanding on wordpress 3.3 widget dashbord
- Cannot save widgets in custom sidebars
- wp_register_sidebar_widget() disappered my Widgets submenu – what am I doing wrong?
- Toggle option in sidebar widgets
- Can’t see widget areas in my customizer
- Widgets not activated alert after using get_sidebar()
- Can you target a widget_class in a register_sidebar?
- Copy Widget Settings because of changed IDs
- How to pass a special CSS class into widget li
- Add class to on sidebar widget
- Save button is not working on custom widget
- Sidebar widgets – dynamic CSS : problem with widget-title
- How to customize wordpress sidebar widget
- Why is registering a sidebar for each page causing my sidebars to reset?
- activate custom sidebar widgets
- How to use register_sidebar’s ‘before_widget’ unique id generator into its other parameters like ‘before_title’?
- After adding widget the style is messing up
- Siderbar implementation with collapsible bootstrap cards
- How to create sidebar from “scratch”?
- My widgets do not save
- How to get sidebar widgets in leftsidebar template
- How Can I Replicate & Register a Widget from the Child Theme
- Widget Areas Still Appearing in WP ADMIN When They Shouldn’t
- $before/after_widget/title not displaying anything
- register_sidebar() will not wrap an element properly
- An issue with register_sidebar and the admin interface
- Unique widget id in sidebar
- is it possible to create custom widgets page in admin?
- Programmatically add widgets to sidebars
- WordPress 3.8 – Dashboard 1 Column Screen Options
- Executing Javascript When a Widget is Added in the Backend
- Loading scripts only if a particular shortcode or widget is present
- Limit number of Widgets in Sidebars
- How Can I Add the “Insert From URL” Tab to a Custom 3.5 Media Uploader?
- Give Editor Access To Sidebar
- How to load Widget javascript + css files only if used?
- Where is the content of widgets stored in mysql table
- Hide specific categories from category widget
- changing wp-admin/widgets.php
- Add class to before_widget from within a custom widget
- How can I use the built in WordPress “browse link” functionality?
- Is there any way to dynamically alter widget titles?
- Translate widget titles using qTranslate plugin
- Code for Recent Posts Widget
- Get number of widgets in sidebar
- Can a widget in the Customizer be “single-use” (i.e. disabled after 1 instance has been added)?
- check if registered sidebar is active & has widget content
- How to edit widgets in WordPress
- dynamically add scripts to WP_Widget widget() method
- Extend WordPress 3.8 Site Activity Dashboard Widget to include more comments
- How to use is_active_widget?
- Get a list of all Widgets registered in WordPress admin widgets-area
- Modifying the default search widget
- Adding iframe Content to Sidebar Widget
- Enabling jquery when dragging available widget to sidebar area
- How Do I Add Custom CSS To Only Certain Widgets
- Get Widget Instance inside Widget
- Show post tags in a widget
- Author template, filter sidebar widgets by author?
- Prevent widgets removal
- Add the sidebar/widget editor to the post edit screen?
- WordPress 4.8: Using multiple WYSIWYG-Editors with media inside of Widgets how to?
- Does the number of widgets installed affect website performance?
- WP_Widget deprecated error in WordPress V4.3
- What is the quickest way to make a widget?
- How to display custom widget anywhere
- Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?
- Get page IDs based on which template they are using?
- Changes in widget customizer not triggering ‘save and publish’
- HowTo: Add Class to Sidebar Widget List-Items
- Add filter to blogroll widget
- Widget Options Not saving
- Indexes of widgets instances starts with ‘2’ in ‘wp_options’ table
- How to use wp_dequeue_style() for style enqueued in WP_Widget class
- Complex widget form UI – examples and best practices
- How do i manually place a widget code
- How to override the wordpress default widget markup
- Why is the $old_instance needed for the widget update function?
- Embed iframe or html page into dashboard widget
- Storing custom dashboard widget options in wordpress
- Prevent second widget activation
- How can I add links to widget titles?
- How to refresh Theme Customizer after change color inside wpColorPicker?
- How to add image uploader to a custom widget?
- PHP Coding Standards, Widgets and Sanitization
- Different widgets on different page templates?
- How to Remove All Widgets from Dashboard?
- Widgets not displaying in theme customizer