Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/mgt9007/mfs-accordion-navigation/archive/refs/heads/main.zipMFS Accordion Navigation Plugin
Description
This plugin adds accordion functionality to WordPress navigation blocks for the My Future Self Digital website. It automatically collapses submenu items and expands them based on the current page or user interaction.
Features
- Auto-collapse: All submenus are collapsed by default
- Smart expansion: Current page and its ancestors automatically expand
- Click to toggle: Click on parent items to expand/collapse submenus
- Smooth transitions: CSS animations for a polished user experience
- Visual indicators: Arrow icons show expandable items and their state
- Sibling collapse: When expanding one section, siblings automatically collapse
Installation
On WordPress.com (Business Plan or Higher)
- Download the plugin ZIP file
- Go to your WordPress dashboard
- Navigate to Plugins → Add New → Upload Plugin
- Click Choose File and select
mfs-accordion-navigation.zip - Click Install Now
- Click Activate Plugin
On Self-Hosted WordPress
- Upload the
mfs-accordion-navigationfolder to/wp-content/plugins/ - Activate the plugin through the Plugins menu in WordPress
Usage
Once activated, the plugin automatically works with any WordPress Navigation block that has submenu items. No configuration needed!
How It Works
- Top-level items (Week 1, Week 2, Account, etc.) show by default
- Submenu items are hidden until:
- You click on the parent item, OR
- You navigate to a page within that section
- Current page ancestry is always visible
- Sibling sections collapse when you expand a different section
Customization
Modifying Styles
Edit /css/accordion-nav.css to change:
- Arrow icons (change the
contentproperty) - Animation speed (modify
transitionvalues) - Colors and spacing
- Indentation levels
Modifying Behavior
Edit /js/accordion-nav.js to change:
- Click behavior
- Animation timing
- Double-click navigation
- Additional features
File Structure
mfs-accordion-navigation/
├── mfs-accordion-navigation.php # Main plugin file
├── css/
│ └── accordion-nav.css # Styling
├── js/
│ └── accordion-nav.js # Accordion logic
└── README.md # This file
Browser Compatibility
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Mobile browsers (iOS Safari, Chrome Mobile)
Troubleshooting
Accordion not working?
- Clear your browser cache
- Clear WordPress cache (if using a caching plugin)
- Check browser console for JavaScript errors
- Ensure your navigation uses the WordPress Navigation block
Styles not applying?
- Check that CSS is loading in page source
- Clear browser cache
- Try adding
!importantto CSS rules if theme conflicts exist
Navigation not expanding on current page?
- WordPress should automatically add
.current-menu-item,.current-menu-parent, and.current-menu-ancestorclasses - Check your menu settings in Appearance → Menus
Future Enhancements
Planned features for future versions:
- Admin settings page
- Customize arrow icons via admin
- Choose animation styles
- Mobile-specific behaviors
- Remember expanded state with localStorage
Support
For issues, questions, or feature requests related to My Future Self Digital, contact Mark.
Version History
1.0.0 (December 2024)
- Initial release
- Basic accordion functionality
- Auto-expand current page ancestry
- Smooth CSS transitions
- Arrow indicators
License
GPL v2 or later
Author: Mark - My Future Self Project Website: https://myfutureself.digital