Project: https://github.com/Esmond-M/em-daily-posts-queue
Author: esmondmccain.com
Version: 0.1.2
Originally made for an intranet website. Packaged as a reusable plugin. Allows daily posts to be displayed on the front end via shortcode. Visitors submit photos through a front-end form; a custom admin role can then review, reorder, and manage the queue. The top post in the queue is automatically rotated out on a weekday schedule using Action Scheduler.
- WordPress: 6.1+
- PHP: 7.4+
- Required Plugin: Action Scheduler
After activation, go to Net Submissions β π Shortcodes in the WP admin sidebar, or check the Daily Posts Queue widget on the main dashboard. Both show copy buttons for each shortcode.
| Shortcode | Where to use |
|---|---|
[EmDailyPostsQueueForm] |
Any page where visitors submit photos |
[EmDailyPostsQueueDisplayPost] |
Any page/widget area to show today's post |
Both shortcodes accept an optional class attribute:
[EmDailyPostsQueueForm class="my-wrapper"]
[EmDailyPostsQueueDisplayPost class="my-wrapper"]
- Photo submission form β front-end shortcode form; visitors upload a photo, headline, and caption (max 8 MB, JPG/PNG)
- Daily post display β shortcode that renders the current first-in-queue post (image, headline, caption)
- Drag-and-drop queue management β admin sub-menu to reorder or remove submissions
- Automatic daily rotation β Action Scheduler advances the queue every weekday; admins can customise the trigger time from the WP timezone settings
- Demo content import β one-click button on the queue edit page to seed 4 sample posts
- Custom post type
net_submissionβ separate from regular posts; supports title and featured image - Custom role
Net Submitterβ limited access; can submit and view own submissions only - Shortcode reference β dedicated admin sub-menu page + dashboard widget so shortcodes are always visible
- Optimistic concurrency β queue edits check for stale data and warn before overwriting
- JSON queue storage β queue stored as JSON (migrated transparently from legacy serialize+base64)
- Download the latest zip from build/em-daily-posts-queue.zip.
- In WordPress admin go to Plugins β Add New β Upload Plugin.
- Upload the zip and activate.
- Install and activate the Action Scheduler plugin.
- Find your shortcodes under Net Submissions β π Shortcodes.
[EmDailyPostsQueueForm]
Visitors fill in a headline, caption, and photo. On submission an email is sent to the site admin.
[EmDailyPostsQueueDisplayPost]
Shows the featured image, headline, and caption of the first item in the queue.
- Go to Net Submissions β Edit Photo Queue
- Reorder items by changing the queue number fields and saving
- Delete individual items with the remove button
- Import demo content with the Import Demo button
- Adjust the daily rotation time under the cron settings panel
Go to Net Submissions to see all submitted posts. Publishing a post automatically appends it to the end of the queue.
| Table | Purpose |
|---|---|
{prefix}edpq_net_photos_queue_order |
Stores queue order as a JSON array of {postid, queueNumber} objects |
| Key | Description |
|---|---|
topic_headline_value |
Submission headline |
topic_caption_value |
Submission caption |
- Slug:
net_submission - Supports: title, thumbnail
- Custom capabilities:
edit_net_submission,read_net_submission,delete_net_submission, etc.
- Net Submitter β can create/read own
net_submissionposts and upload files; no access to queue management - Administrator β full access including queue edit, wipe, and cron controls
| Shortcode | Class | Description |
|---|---|---|
[EmDailyPostsQueueForm] |
EmDailyPostsQueue\init_plugin\Classes\Shortcodes |
Renders the photo submission form |
[EmDailyPostsQueueDisplayPost] |
EmDailyPostsQueue\init_plugin\Classes\Shortcodes |
Renders the current daily post |
| Hook | Description |
|---|---|
init |
CPT registration, role setup, cron scheduling |
add_meta_boxes |
Custom meta box registration |
save_post |
Saves headline/caption meta |
publish_net_submission |
Appends post to queue on first publish |
trashed_post |
Force-deletes instead of trashing |
eg_1_weekdays_log |
Action Scheduler hook that advances the queue |
| Hook | Description |
|---|---|
post_row_actions |
Removes Quick Edit and Trash from submission list |
bulk_actions-edit-net_submission |
Removes bulk edit action |
template_include |
Loads plugin template for single net_submission view |
- WordPress local environment with database access
- Composer
- PHPUnit (included via composer)
- Node.js + npm (for
plugin-zipbuild script)
git clone https://github.com/Esmond-M/em-daily-posts-queue.git
cd em-daily-posts-queue
composer installConfigure tests/wp-config.php:
define( 'DB_NAME', 'wordpress_test' );
define( 'DB_USER', 'your_username' );
define( 'DB_PASSWORD', 'your_password' );
define( 'DB_HOST', 'localhost' );npm run plugin-zip
# Output: build/em-daily-posts-queue.zipem-daily-posts-queue/
βββ admin/assets/ # Admin-only CSS and JS
βββ assets/ # Frontend CSS, JS, images
βββ classes/
β βββ class-cpt-net-submission.php # CPT registration + roles
β βββ class-cpt-net-submission-meta.php # Meta box (headline, caption)
β βββ class-cron-event-timer.php # Action Scheduler scheduling
β βββ class-cron-events.php # Weekly queue rotation logic
β βββ class-photo-submission-ajax.php # All AJAX handlers
β βββ class-photo-submission-queue-manager.php # Main admin controller
β βββ class-photo-submission-utils.php # DB helpers, queue encode/decode
β βββ class-shortcodes.php # Frontend shortcode renderers
βββ templates/
β βββ options-page-admin-queue-edit.php # Queue reorder UI
β βββ options-page-admin-queue-list.php # Queue read-only list
β βββ shortcode-reference.php # Shortcode reference card
β βββ single-net-submission.php # Single post template
βββ tests/
β βββ bootstrap.php
β βββ EmDailyPostsQueueUIManagerTest.php
β βββ wp-config.php
βββ docs/
βββ vendor/
βββ composer.json
βββ phpunit.xml
βββ package.json
βββ em-daily-posts-queue.php # Plugin entry point
βββ readme.md
# Run all tests
.\vendor\bin\phpunit --bootstrap tests/bootstrap.php tests
# Run with verbose output
.\vendor\bin\phpunit --bootstrap tests/bootstrap.php tests --verbose- CPT registration, roles, capabilities
- Meta box rendering and save
- Queue array comparison and conflict detection
- Cron scheduling and queue rotation
- Shortcode registration
- AJAX handler security (nonce, capability checks)
- Security: Replaced
serialize/base64queue storage withjson_encode; eliminates PHP object injection risk - Security:
net_photo_deletion_info_ajaxno longer registered asnopriv; added nonce and capability checks to AJAX handlers - Security: Sanitised all
$_POSTinputs (sanitize_text_field,sanitize_textarea_field,(int)casts) - Security:
$wpdb->prepare()used consistently; removed one unparameterisedUPDATEquery - Feature: Added Shortcodes submenu page (π) under Net Submissions CPT menu
- Feature: Added dashboard widget showing both shortcodes with copy-to-clipboard buttons
- Bug fix: Fatal
TypeError: Cannot access offset on stringon queue list page when DB contained the install greeting row - Bug fix:
get_queue_list_from_dbandget_queue_listwere identical; unified viadecode_queue()helper with legacy migration - Bug fix:
new CronEventsat file scope removed; instantiation moved to plugin bootstrap only - Bug fix:
wp_set_current_user()hack replaced with directadmin_url()call for edit links
- Queue system now guarantees sequential queue numbers (no gaps)
- Changed admin queue container class name for uniqueness
- Removed bulk edit options for net_submission post type
- Added demo content import button to admin queue edit page
- Added cron event time update and display using WordPress timezone
- Added stubs for Action Scheduler functions to prevent IDE warnings
- Disabled submit buttons during form submission for better UX
- Initial release
- Custom post type and user role creation
- Frontend form and display shortcodes
- Queue management system
- Cron-based automatic posting
- Comprehensive test suite
For issues and feature requests, please visit the GitHub repository.
This plugin is licensed under GPL
