Add custom post types to calendar
I had to alter the plugin code a little bit to add custom post type capability to the calendar. There were two steps to get it done:
First step: add custom post type to the wpdb-query so it would get the dates of this custom post type into the calendar. Opening the plugin (which luckily only consists of one document) in Dreamweaver and searching for it, I found four instances that needed to be changed.
post_type = 'post'
Needs to become this:
post_type IN ('post', 'CUSTOM_POST_TYPE_NAME')
Second step: add a meta box to the plugin code so the calendar will also be displayed on the add new/edit page. You need to add the following code just right below where you can find the original meta box which places a calendar on the add new post/edit page; don’t forget to put it into the bracket.
Add this code:
add_meta_box( 'future_calendar', 'Future Posts', 'get_future_calendar_html', 'CUSTOM_POST_TYPE_NAME', 'side', 'high' );
It is quite simply really.
- The topic ‘Add custom post types to calendar’ is closed to new replies.