Search code examples
wordpressfilterwidgetsidebaraction

Wordpress - Add a div around archive widget


I use Wordpress and have a sidebar containing widgets, run by this code:

<div class="sidebar modern">
    <?php if ( is_active_sidebar( 'sidebar-modern' )) : ?>
        <ul>
            <?php dynamic_sidebar( 'sidebar-modern' ); ?>
        </ul>
    <?php else : ?>
    <?php endif; ?>
</div>

What I do in wp-admin

  1. I add the archive widget
  2. I set display as a select-list (dropdown) in widget options

What I need is to add a container HTML class to the select.

I have tried these and failed:

  • CSS (because it's a design thing)
  • Filter - widget_archives_dropdown_args
  • Filter - wp_get_archives filter

If it's possible to add a container class to all the widget inside (widget title not included), it would be fine by me.


Solution

  • It's not possible right now without editing the Wordpress core.