You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the “Add Contest” functionality in the WordPress admin dashboard is implemented inside the functions.php file of the Astra child theme. While it works, this approach mixes theme and functionality logic — which is not recommended for scalability or maintainability.
This issue proposes migrating this functionality into a standalone WordPress plugin, making it reusable, portable, user-friendly, and easier for contributors to maintain or enhance.
Objective
Create a plugin that allows admins to:
Add new Codeheat event/contest pages directly from the WP admin dashboard.
Choose from multiple predefined template pages.
Set start and end dates dynamically (auto-inserted in placeholders [START_DATE] and [END_DATE] in templates).
Automatically redirect to the page editor after creation.
Automate menu creation and duplication when new contest pages are published.
Ensure security with proper nonce checks (CSRF protection).
Current Implementation
Implemented in functions.php of the Astra child theme.
Key features already working:
Multiple Templates: Admin can choose between templates such as “Template: Codeheat with Summit” and “Template: Bi-monthly Contest.”
Start & End Date Fields: Admin can select contest start and end dates in “Month Day, Year” format (e.g., September 30th, 2025). It requires adding placeholders [START_DATE] and [END_DATE] in template pages.
Improved Workflow: On click of 'Create Contest' button, automatically redirects to the WordPress editor.
Security Enhancements: Added wp_nonce_field() and check_admin_referer() for form submission protection.
Current Limitation
The homepage uses a globally defined menu, but each contest year (e.g., “Codeheat 2021”) has its own dedicated menu.
Currently, menus must be manually created or duplicated using a third-party plugin.
Contest creation is manual, non-modular, and lacks automatic linking under the "About" menu.
Proposed Solution
1. Automatic Menu Duplication & Linking
When a new Codeheat contest page (e.g., “Codeheat 2025”) is created:
Duplicate the “Template Menu” automatically.
Rename it to match the contest year (e.g., 2025). For this purpose, the slug of the webpage can be used.
Place the new contest page as a submenu under “About” in the existing menu as well as other menus.
Ensure all menus remain editable under Appearance → Menus, allowing users to add, remove, or reorganize items.
Summary
Currently, the “Add Contest” functionality in the WordPress admin dashboard is implemented inside the
functions.phpfile of the Astra child theme. While it works, this approach mixes theme and functionality logic — which is not recommended for scalability or maintainability.This issue proposes migrating this functionality into a standalone WordPress plugin, making it reusable, portable, user-friendly, and easier for contributors to maintain or enhance.
Objective
Create a plugin that allows admins to:
[START_DATE]and[END_DATE]in templates).Current Implementation
Implemented in
functions.phpof the Astra child theme.Key features already working:
[START_DATE]and[END_DATE]in template pages.wp_nonce_field()andcheck_admin_referer()for form submission protection.Current Limitation
Proposed Solution
1. Automatic Menu Duplication & Linking
When a new Codeheat contest page (e.g., “Codeheat 2025”) is created:
2025). For this purpose, the slug of the webpage can be used.Implementation Reference:
🛠️ Recommended Next Steps
/wp-content/plugins/plugin-name/functions.phpinto the plugin’s main file, e.g.,plugin-name.phpadd_event_creator_menu,create_event_page, etc.) but register hooks from within the plugin.WPFA-plugin-name).WPFA-plugin-name) to prevent conflicts.__()/_e()).wp_safe_redirect()instead ofwp_redirect().current_user_can())._created_byand_created_onas post meta.[codeheat_events]or REST API endpoint for front-end display.