Hi John:
I think this is what you are looking for (I’d explain the code be I think it’s self-explanatory; let me know if not):
<?php
add_filter('dynamic_sidebar_params','my_dynamic_sidebar_params');
function my_dynamic_sidebar_params($params) {
$sidebar_id = $params[0]['id'];
$sidebar_widgets = wp_get_sidebars_widgets();
$last_widget_id = end($sidebar_widgets[$sidebar_id]);
if ($last_widget_id==$params[0]['widget_id'])
$params[0]['before_widget'] = str_replace(' class="',' class="last_widget ',$params[0]['before_widget']);
return $params;
}
Related Posts:
- Programmatically add widgets to sidebars
- Loading scripts only if a particular shortcode or widget is present
- Give Editor Access To Sidebar
- Where is the content of widgets stored in mysql table
- Get number of widgets in sidebar
- Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- Different widgets on different page templates?
- Widgets not displaying in theme customizer
- Register multiple sidebars
- How to add author details in the post sidebar?
- Determining a Widget Instance and Sidebar Location?
- Randomize widgets displayed in my sidebar [duplicate]
- Remove All Widgets from Sidebar
- Add div class to only one widget
- Unregistering a Sidebar in Child Theme
- Problems with the sidebar args and wp_list_bookmarks
- Ban certain widgets from certain sidebars
- is_active_sidebar() Always Returns False
- Call sidebar from a template
- How could a Widget behave differently depending on sidebar
- Adding classes to dynamic sidebar
- Create variable from widget instance
- Save/update widget outside admin panel [closed]
- WordPress: Apply filter/hook to a particular sidebar widgets?
- How to insert widget areas specific to certain pages (or posts, etc.)?
- Why use dynamic_sidebar() conditionally?
- wordpress widget textbox in the sidebar
- WordPress Widget multiple use
- Contact Form in sidebar [closed]
- More flexible sidebar and widget management
- WordPress widget new instance creates content duplicates
- duplicate sidebar
- How to check if searchform.php is being included as widget?
- How to get sidebar’s content inside admin-ajax?
- Removing custom widget area WordPress 4.4 [closed]
- Full width layout for custom post type pages
- How to “pair” two widgets side by side in one sidebar [closed]
- Dynamic Sidebars On Multiple Subpages
- Cannot save widgets in custom sidebars
- Check which registered sidebar a widget is added to
- Disable widgets on specific posts
- Display the id list of active widgets of same sidebar?
- How to remove a widget from the sidebar on specific page?
- Add individual tag to widget title in sidebar
- Excluding specific widgets from default sidebar class
- Can WordPress Read Its Own RSS Feed?
- Can’t see widget areas in my customizer
- Dynamic sidebar based on category
- Widgets not activated alert after using get_sidebar()
- How to show different widgets on different pages in a user friendly way
- Show widget differently depending on if it’s in the sidebar or footer
- How can I get the first section of a page 100% width, while the rest will have a sidebar? [closed]
- Trying to create dynamic widget area using post ID
- Dynamically add content to an existing widget area
- How can I inject html after the [x]th widget inside a Sidebar? [duplicate]
- Copy Widget Settings because of changed IDs
- Programmatically add widgets to sidebars
- Programmatically add widgets to sidebars
- How to call widget by widget’s id?
- Show a widget as a sidebar fallback
- register_sidebar fails when using a include within functions.php
- Update widget form after drag-and-drop “only specific plugin”
- Recent Comments from Specific Category Widget
- Add a specific css to a widget
- Different sidebars not changing
- Is there a simple way to have a new sidebar for each page?
- how to add the same Widget twice to a sidebar?
- Filter Text from sidebar widget?
- Add class to on sidebar widget
- My widget not printing before_widgets and after widgets
- Multiple rows of footer widget areas
- Output column number according to active sidebars
- Check if widget is inside sidebar with PHP
- New Widget are not showing
- How do I exclude portrait pictures from the nextgen gallery sidebar widget?
- Upgraded to 3.3, My Widgets Disappeared
- changing the style of sidebar
- WordPress Local to Live and The Missing Widgets!
- Need to delete the sidebar widget area and have the page a full page rather than just have a blank widget area
- Before_widget won’t show up
- Reposition the widget sidebar in Appearance->Widgets
- Handling dozens of sidebars
- Does current page contain widget or sidebar
- widgets_init actions not fired from functions.php’s child theme
- Active Sidebar Conditional Question?
- Target logic based on Widget / Sidebar Name
- Paginate recent posts widget
- Add sidebar in inner pages
- $before/after_widget/title not displaying anything
- Inkness theme sidebar
- Automatically hide Widgets that would lengthen page
- Single Widget Multi Sidebar
- Unique widget id in sidebar
- How to exclude a widget from showing up on a page?
- How to hide sidebar widgets in all pages except Hompage?
- Subpages menu on sidebar plus widgets
- Keeping shortcode-generated widget and theme element in one line [closed]
- How to inject a virtual widget (i.e. without adding it to the database) to the sidebar
- Can’t edit the widgets sidebar or footer