Enjoying these plugins? ☕ Buy me a coffee to support ongoing development.

Simple Editorial Calendar

A lightweight drag-and-drop editorial calendar for WordPress that allows you to visually schedule and manage your posts.

Single File v1.0.0 Updated 1 month ago

YT Simple Editorial Calendar

A lightweight drag-and-drop editorial calendar for WordPress that allows you to visually schedule and manage your posts.

Features

  • Visual Calendar View: Month-by-month calendar grid displaying all your posts
  • Drag & Drop Scheduling: Simply drag posts to different dates to reschedule them
  • Post Status Indicators: Color-coded badges for published, scheduled, and draft posts
  • AJAX Updates: Instant date changes without page reloads
  • Lightweight: Single PHP file with minimal CSS and JavaScript
  • No External Dependencies: Only requires jQuery UI (included in WordPress)
  • Responsive Design: Works on desktop, tablet, and mobile devices

Installation

  1. Upload the yt-simple-editorial-calendar folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Access the calendar from the 'Calendar' menu item in the WordPress admin sidebar

Usage

Viewing the Calendar

  1. Navigate to Calendar in the WordPress admin menu
  2. The current month is displayed by default
  3. Use the Previous/Next buttons to navigate between months
  4. Click Today to return to the current month

Rescheduling Posts

  1. Find the post you want to reschedule on the calendar
  2. Click and drag the post to a new date
  3. Drop it on the target date
  4. The post date is updated automatically via AJAX

Understanding Post Status Colors

  • Green: Published posts
  • Yellow: Scheduled (future) posts
  • Blue: Draft posts

Editing Posts

  • Click on any post title to open the post editor in a new tab

Technical Details

File Structure

yt-simple-editorial-calendar/
├── class-yt-simple-editorial-calendar.php  # Main plugin file
├── assets/
│   ├── css/
│   │   └── calendar.css                    # Calendar styles
│   └── js/
│       └── calendar.js                     # Drag & drop functionality
└── README.md                               # This file

Constants Defined

YT_SIMPLE_EDITORIAL_CALENDAR_VERSION  // Plugin version (1.0.0)
YT_SIMPLE_EDITORIAL_CALENDAR_BASENAME // Plugin base name
YT_SIMPLE_EDITORIAL_CALENDAR_PATH     // Plugin directory path
YT_SIMPLE_EDITORIAL_CALENDAR_URL      // Plugin directory URL

Main Class Methods

Public Methods

  • get_instance() - Get singleton instance
  • ytsec_load_textdomain() - Load translations
  • ytsec_add_admin_menu() - Register admin menu
  • ytsec_add_action_links() - Add plugin action links
  • ytsec_enqueue_admin_scripts() - Enqueue CSS/JS
  • ytsec_render_calendar_page() - Render calendar page
  • ytsec_ajax_update_post_date() - Handle AJAX date update
  • ytsec_ajax_get_calendar_data() - Handle AJAX calendar refresh

Private Methods

  • init_hooks() - Initialize WordPress hooks
  • ytsec_get_calendar_data() - Generate calendar HTML
  • ytsec_get_posts_for_month() - Query posts for specific month

AJAX Endpoints

Update Post Date

Action: ytsec_update_post_date

Parameters:

  • post_id (int): Post ID to update
  • new_date (string): New date in YYYY-MM-DD format
  • nonce (string): Security nonce

Response:

{
  "success": true,
  "data": {
    "message": "Post date updated successfully.",
    "post_id": 123,
    "new_date": "2025-10-25"
  }
}

Get Calendar Data

Action: ytsec_get_calendar_data

Parameters:

  • month (int): Month number (1-12)
  • year (int): Year
  • nonce (string): Security nonce

Response:

{
  "success": true,
  "data": {
    "html": "...",
    "month": 10,
    "year": 2025
  }
}

Security Features

Implemented Security Measures:

  • Nonce verification for all AJAX requests
  • Capability checks (edit_posts, edit_post)
  • Input sanitization with sanitize_text_field() and intval()
  • Output escaping with esc_html(), esc_attr(), esc_url()
  • Direct file access prevention
  • SQL injection protection via WP_Query
  • XSS protection via WordPress escaping functions

Browser Compatibility

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers (iOS Safari, Chrome Mobile)

Requirements

  • WordPress 5.8 or higher
  • PHP 7.4 or higher
  • jQuery (included in WordPress)
  • jQuery UI Draggable & Droppable (included in WordPress)

Customization

Changing Calendar Appearance

Edit assets/css/calendar.css to customize:

  • Colors for post status badges
  • Grid layout and spacing
  • Font sizes and styles
  • Hover effects

Modifying Drag & Drop Behavior

Edit assets/js/calendar.js to customize:

  • Drag animation effects
  • Drop validation rules
  • Notification messages
  • AJAX behavior

Adding Custom Post Types

To include custom post types in the calendar, modify the ytsec_get_posts_for_month() method:

$args = array(
    'post_type'      => array( 'post', 'your_custom_type' ), // Add your type here
    'post_status'    => array( 'publish', 'future', 'draft' ),
    // ... rest of args
);

Filtering Posts

To filter posts by category or other criteria, add to the $args array in ytsec_get_posts_for_month():

$args = array(
    // ... existing args
    'category_name' => 'news', // Filter by category slug
    'author'        => 1,       // Filter by author ID
);

Troubleshooting

Posts Don't Drag

Issue: Post items are not draggable.

Solution:

  • Ensure jQuery UI is loaded (check browser console)
  • Clear browser cache
  • Check for JavaScript conflicts with other plugins

Date Not Updating

Issue: Dragging works but date doesn't update.

Solution:

  • Check user has edit_post capability for the post
  • Verify AJAX URL is correct (check browser console)
  • Look for PHP errors in debug.log
  • Ensure nonce is valid (not expired)

Calendar Not Displaying

Issue: Calendar page is blank or shows errors.

Solution:

  • Verify minimum WordPress version (5.8+)
  • Check PHP version (7.4+)
  • Enable WP_DEBUG to see error messages
  • Deactivate other plugins to check for conflicts

Performance Considerations

  • Displays up to 500 posts per month (configurable)
  • Uses WordPress transients for caching (can be added)
  • Minimal database queries (single WP_Query per month)
  • Lightweight assets (~15KB total)

Line Count

  • Main PHP file: ~510 lines
  • CSS file: ~280 lines
  • JavaScript file: ~240 lines
  • Total: ~1030 lines (within reasonable limits for a single-feature plugin)

Future Enhancements

Possible features to add (while keeping it lightweight):

  • [ ] Filter by post status
  • [ ] Filter by category/tag
  • [ ] Quick edit post title inline
  • [ ] Multiple post selection and bulk move
  • [ ] Keyboard shortcuts for navigation
  • [ ] Print calendar view
  • [ ] Export calendar to PDF/CSV

Support & Contribution

For issues, questions, or contributions:

  • Report bugs via GitHub Issues
  • Submit pull requests for improvements
  • Follow WordPress Coding Standards (WPCS)

License

GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html

Credits

Built following WordPress Plugin Handbook and WPCS guidelines.

Author: Krasen Slavov Plugin URI: https://github.com/krasenslavov/yt-simple-editorial-calendar

Changelog

1.0.0 (2025-10-20)

  • Initial release
  • Drag-and-drop calendar functionality
  • AJAX date updates
  • Post status color coding
  • Responsive design
  • Translation ready