Skip to main content
Easily create better & faster websites with the Total WordPress Theme Learn More
(opens a new tab)
Tutorials

CSS Style For The WordPress Calendar Widget

I see a lot of WordPress theme developers do this and I know I’ve done it a lot in the past…we forget to include ALL the styles for the core WordPress classes, like the  image alignments, captions and widgets. That is why I have added it to my WordPress Theme Development Checklist. Most of these classes are pretty easy to customize and I have already created a standard CSS which I use and customize for any theme I work on, today I decided to share a very simple style for your WordPress Calendar widget, which you can copy and paste into your theme’s style.css file to give it this minimal look.

Calendar Widget CSS

Below is the CSS required to give your calendar widget this minimal look. Note: The shadow around the calendar is just for the image on the post.

/* calendar widget */
.widget_calendar {float: left;}
#wp-calendar {width: 100%; }
#wp-calendar caption { text-align: right; color: #333; font-size: 12px; margin-top: 10px; margin-bottom: 15px; }
#wp-calendar thead { font-size: 10px; }
#wp-calendar thead th { padding-bottom: 10px; }
#wp-calendar tbody { color: #aaa; }
#wp-calendar tbody td { background: #f5f5f5; border: 1px solid #fff; text-align: center; padding:8px;}
#wp-calendar tbody td:hover { background: #fff; }
#wp-calendar tbody .pad { background: none; }
#wp-calendar tfoot #next { font-size: 10px; text-transform: uppercase; text-align: right; }
#wp-calendar tfoot #prev { font-size: 10px; text-transform: uppercase; padding-top: 10px; }

Calendar Widget Style (what it should look like)

Once you have added the CSS above to your WordPress theme, the calendar widget should look like the following image. If it doesn’t it’s possible your theme already has some styles built-in for tables or the widget itself which is overriding your newly added CSS. Of course this is a very simple style widget but it’s always easier to start with a simple style and go from there. Plus, who even uses the Calendar widget these days?

WordPress Calendar Widget Style

Do you use the calendar widget? I’m curious to know, please let me know in the comments below. Personally I’ve never used the widget but as a developer it’s important to style it incase someone using your theme does want to use it.

23 Comments
  1. Henry · 12 years ago

    Nice and clean style, love it. All I would do extra is center the table headings:

    #wp-calendar thead th {
    padding-bottom: 10px;
    text-align: center;
    }

  2. Marinho · 12 years ago

    Show! It’s amazing! Some adaptations for me:

    .widget_calendar {float: left;}
    #wp-calendar {width: 100%; background:#EBF5FB; }
    #wp-calendar caption { border-top:1px dotted #3F89E2; text-align: right; font-weight:bold; color: #333; font-size: 12px; margin-top:-10px; padding:10px 10px 0 0; padding-bottom: 15px;  background:#EBF5FB;}
    #wp-calendar thead { font-size: 10px; }
    #wp-calendar thead th { padding-bottom: 10px; }
    #wp-calendar tbody { color: #aaa; }
    #wp-calendar tbody td { background: #f5f5f5; border: 1px solid #fff; text-align: center; padding:8px;}
    #wp-calendar tbody td:hover { background: #fff; }
    #wp-calendar tbody .pad { background: none; }
    #wp-calendar tfoot #next { font-size: 10px; text-transform: uppercase; text-align: right; }
    #wp-calendar tfoot #prev { font-size: 10px; text-transform: uppercase; padding-top: 0px; }
    #wp-calendar thead th {padding-bottom: 10px; text-align: center;}
    
  3. Igor · 12 years ago

    Please,
    can someone tell me what to write in my Custom CSS that calendar shows each month, regardless of whether I post every month or not.
    Thx …

    • AJ Clarke | WPExplorer · 12 years ago

      That’s not a CSS edit. You’ll have to change the whole calendar functionality.

    • Elliott · 5 years ago

      That isn’t down to CSS Styling.

      WordPress generates the calendar based on posts and only makes code for months with posts.

  4. ximenita11 · 11 years ago

    Hi, how can i put the button of the next month, because you have only the prev button which in this case it <May.

    • AJ Clarke | WPExplorer · 11 years ago

      The WordPress calendar widget is used for showing published posts. You shouldn’t have any published posts in the future because it’s impossible 😉

      • priscila gonzaga · 11 years ago

        It is possible! I’m able to publish in the future, for example, using the “the future is now” plugin — this is quite important for the project i’m working on, and I’m having the same issue as ximenita… any help? thanks in advance!

        • AJ Clarke | WPExplorer · 11 years ago

          Unfortunately I am not quite sure…My suggestion is to maybe look for a more advanced calendar widget plugin.

  5. jansen · 11 years ago

    Fantastic output, at last. I’ve made one-more change (to fit my theme), plus center table headings as suggested above :

    top two lines changed to below

    .widget_calendar {float: center;}
    #wp-calendar {max-width: 300px;}

  6. Devin Walker · 11 years ago

    This is exactly what I needed. You are the man!

  7. Ekhan · 11 years ago

    Thanks it’s work for me.

  8. bogdan · 11 years ago

    Thanks a lot) it is the thing i’ve been looking for)

  9. Rhonda · 11 years ago

    Great tutorial, this helped me style my calendar better.

    When I click on the previous calendar month, the formatting is off. However on the home page the calendar displays perfectly. How do I make sure previous month calendar styles are consistent with what shows on the home page?

    • AJ Clarke | WPExplorer · 11 years ago

      That sounds more like your CSS is only loading on the homepage. Double check that your site isn’t being cached and that your CSS is actually loading on all pages.

  10. Ahmed Bouhuolia · 11 years ago

    add to element #wp-calendar thead th { padding-bottom: 10px; } text-align: center; to edit font in center box 🙂

  11. Jonathan · 11 years ago

    This is so convenient thank you, saved me 15 mins of headache.

  12. DarthYannick · 11 years ago

    Thanks as well 🙂

    Never used that calendar because I never really know the css for it. Cool. 🙂

  13. martinrodrigofranco · 10 years ago

    AMAZING MAN !

  14. Adam · 10 years ago

    Thank you, thank you, thank you.

  15. Michael · 10 years ago

    This is awesome. Just what I was looking for. Thanks!!

  16. Yavor Spassov · 9 years ago

    Works perfect for my theme. Thanks!

  17. Elliott Rodgers · 3 years ago

    I’m a developer, I love the calendar. Instantly shows how often someone blogs. Easy access into day archives. Also fun sometimes to see what can be made from it CSS Styling wise.

    I think it is a really undervalued part of WordPress that needs some TLC and tweaks. For example maybe should be able to click on the month in caption tag to go to a month archive?

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed by viewing our privacy policy here.