Title: Style wordpress categories widget
Last modified: August 19, 2016

---

# Style wordpress categories widget

 *  Resolved [thanksforthehelp](https://wordpress.org/support/users/thanksforthehelp/)
 * (@thanksforthehelp)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/)
 * I want to set my categories widget to display the category selection dropdown,
   but there’s no `<li>` tag before the `<select>` so my css isn’t styling it like
   it should.
 * I know to edit it is in widgets.php but I can’t find the html code to add the`
   <li>' tags before the`<select>` tag.
 * Any help would be appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695742)
 * Instead of modifying the widget code, why not fix your CSS to style it correctly
   instead?
 *  Thread Starter [thanksforthehelp](https://wordpress.org/support/users/thanksforthehelp/)
 * (@thanksforthehelp)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695747)
 * Thanks for the response Otto42. To answer your question:
 * I’ve coded it so that the `<li>` adds borders. I want to keep away from using
   background images to display the borders. The module blocks have round corners
   they need to expand to accommodate the content. As it is now, I have the surrounding`
   <h2>` displaying top round border, child `<li>` displaying the borders, and the
   main `<li>` that encompasses the header and content displaying the bottom round
   border.
 * The way it is now, there is no child `<li>` or any block element surrounding 
   the `<select>` tags. So I need to add them.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695755)
 * I get what you’re saying, but that doesn’t really make any sense. I mean, in 
   that case it sounds like your theme is broken instead.
 * See, every widget will have the same surrounding items, including the categories
   widget. So adding an extra LI in there doesn’t really make any sense. All sidebar
   items look the same, only their content changes. That’s the whole point.
 * Give us a link to your site so we can see what you’re doing. Also give us the
   first part of the theme’s functions.php, so we can see the call to register_sidebar.
 *  Thread Starter [thanksforthehelp](https://wordpress.org/support/users/thanksforthehelp/)
 * (@thanksforthehelp)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695760)
 * [http://tinyurl.com/35ebxq](http://tinyurl.com/35ebxq)
 * The “categories 3” block is on the 3rd column below the search.
 * WP does generate the `<li>` child element, my mistake, I actually need to add
   another `<ul>``<li>` and not just a `<li>`. The way wp widgets.php has it now,
   the tree looks like `<ul>``<li>``<h2>` and then the content.
 * For this specific block the tree is `<ul>``<li>``<h2>``<select>`. I need it to
   be `<ul>``<li>``<h2>``<ul>``<li>``<select>`.
 * Thanks.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695773)
 * Hmmm.. Well, okay.
 * Find this in the widgets.php file:
 *     ```
       if ( $d ) {
       wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category'));
       ?>
       ```
   
 * Change it to this:
 *     ```
       if ( $d ) {
       echo '<ul><li>';
       wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category'));
       echo '</li></ul>';
       ?>
       ```
   
 *  Thread Starter [thanksforthehelp](https://wordpress.org/support/users/thanksforthehelp/)
 * (@thanksforthehelp)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695794)
 * Works like a charm. Thanks Otto42. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Style wordpress categories widget’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [widget styles](https://wordpress.org/support/topic-tag/widget-styles/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [thanksforthehelp](https://wordpress.org/support/users/thanksforthehelp/)
 * Last activity: [18 years, 3 months ago](https://wordpress.org/support/topic/style-wordpress-categories-widget/#post-695794)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
