The other day a user posted a question on the WordPress Stack Exchange about how to display a calendar of your site’s custom post types, much like the default WP Calendar widget. After a quick google search, I found a function written by Jennifer Dodd that did exactly this. The user who asked the question was pleased with the result, so I thought I’d go ahead and take Jennifer’s work a step further and create a plugin out of the function so that you could have it available as a widget.

The widget is very simple with just three options:

  1. Widget Title
  2. Restrict to a single post type
  3. The post type to show

The second option allows you to turn on/off the option that causes the calendar to show only a specific post type. If you disable it, the calendar will show all public post types. If it is enabled, then you can choose the post type to display from the drop down below.

Please download the plugin for free below and let me know what you think!

Download
  1. Pepo

    It doesn’t workd for me. I’m getting “Page Not Found” when i click on a day.

    • pippin

      @Pepo – you may need to update your permalink structure

  2. Pepo

    I’ve try to update, but it doesn’t works for me. The htaccess was correctly writed with the wordpress permalink menu. How I have to update my permalink structure?

    • pippin

      @Pepo – Go to Settings > Permalinks and click Save Changes

  3. Lizz

    I am also keep getting “Page Not Found”. :((

    • Pippin

      @Lizz – I will try to look into it.

  4. Mohammad Akif

    i was looking for archive calender plugin 🙁

    • Pippin

      @Mohammad – Can you explain what you wanted?

  5. Pepo

    Pippin I am also keep getting “Page Not Found”

  6. Pippin

    @Pepo – so are others. I’ll have to look into the code and see if I can find a fix.

  7. Kunal

    I was looking for such a plugin but with some additional features.

    I have created a post-type Events. Now, for this, events have custom fields like Event Start Date and Event End Date. What I want is that, the calendar should show posts only from Event post-type on the dates when an event is starting.

    Please let me know this can be done.

    • Pippin

      Have you looked at the Events Calendar (pro version also avail)? It has all the features you need.

  8. Kunal

    Hi

    Does it (the free version) works for custom post type?

  9. Kunal

    I have installed the CPT Calendar today and tried to make some changes to it like: I have a custom post-type Events and in Events there are custom fields like Event Start Date (data for which get stores in wp_postmeta table). So, in the CPT Calendar widget plugin I have made changes to SQL queries such that now the calendar shows post (Events) names on hovering for the events on those dates in the current calendar month.

    Though I haven’t created any plugin for WP yet. So, would request you to create this plugin (a minor tweak to CPT). Also, one more additional feature requested is that, we should also be able to see next month calendar and events. (could this be possible)?
    Thanks.

    • Pippin

      If you want to hire me for custom plugin dev, you can email me

  10. elvis

    The widget selection looks fine, the output of the calendar shows the correct dates that have posts, but the link to the archive page doesn’t include the post type, so just shows the archive which by default shows only Posts. The url needs to have ?post_type=CPT_name added to the end

    • Pippin

      @elvis – yes, thanks for noticing that.

  11. elvis

    Hiya
    I changed line 297 to this
    $calendar_output .= ‘$day“;

    This worked for me for a calendar with only 1 custom type that I want to show, but I did notice that It made a change to the built in wordpress calendar, which doesn’t work as it adds both post types to the url.

    • Pippin

      @elvis – yes, this function over writes the default calendar widget

  12. Academc sonet

    Great plugin .works nicely as you describe in my udesign wordpress theme

  13. Mike Payne

    Did anyone ever figure out the 404 error?

    • Pippin

      I personally didn’t, sorry.

    • phpcore

      just update the permalinks in wordpress admin panel, just press update button (save)

  14. phpcore

    update the previous comment:

    $query_str = ”;
    } else {
    /* Trust but verify. */
    $my_post_types = array();
    $nb_post_types = 0;
    foreach ( $post_types as $post_type ) {
    if ( post_type_exists( $post_type ) ){
    $my_post_types[] = $post_type;
    $nb_post_types++;
    }
    }
    $post_types = $my_post_types;
    if($nb_post_types > 1) $query_str = ”;
    else {
    $postType = trim(implode(”,$post_types));
    if(isset($_SERVER[‘QUERY_STRING’]) && trim($_SERVER[‘QUERY_STRING’]) != ”)
    $queryString = str_replace(‘post_type=’.$postType, ”, trim($_SERVER[‘QUERY_STRING’]));
    else
    $queryString = ”;
    if($queryString != ”) $start = ‘&’;
    else $start = ‘?’;
    $query_str = $start.’post_type=’.$postType;
    }
    }

    _____________________________________________
    Now put : $query_str at the end of each get_xxx_link

    • Carlos

      In RAW Code PLZ or order your code

      Thnx

  15. Rick van de Kamp

    For the 404 error make sure Achrives.php includes posts from your custom post type. Place this snippit in you functions.php


    function namespace_add_custom_types( $query ) {
    if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
    'post', 'YOUR_CUSTOM_POST_TYPE'
    ));
    return $query;
    }
    }
    add_filter( 'pre_get_posts', 'namespace_add_custom_types' );

  16. JP

    Thanks Pippin for the plugin, this worked for me “right out of the box” on WordPress 3.6.

  17. Thiago

    How to show in calendar the future posts?

Comments are closed.