Follow these steps in order to implement the WordPress to Markdown Exporter plugin.
- Create the main plugin file with required WordPress headers
- Set up the plugin activation/deactivation hooks
- Create the basic plugin class with singleton pattern
- Add admin menu registration
- Create the admin page class
- Create the admin page view template
- Add CSS for admin styling
- Register admin assets (CSS/JS)
- Create function to get available post types
- Add post type dropdown to admin interface
- Create function to fetch all posts of selected type
- Create uploads directory structure
- Implement WordPress filesystem API checks
- Create file handling class for zip operations
- Add functions for cleaning up old files
- Create HTML to Markdown converter class
- Implement content cleaning (remove embeds, comments)
- Add block content handling
- Create filename generation with date prefix option
- Create main export handler class
- Implement batch processing for posts
- Add progress tracking
- Create log generation for success/failures
- Implement zip file creation
- Create function to list existing exports
- Add download link generation
- Implement cleanup functionality
- Add file size and date display
- Add capability checks
- Implement nonce verification
- Add error handling and messages
- Add timeout prevention for large exports
- Test with different post types
- Test with large number of posts
- Verify file permissions
- Test cleanup functionality
- Follow WordPress coding standards
- Use meaningful function and variable names
- Add comments for complex operations
- Each class should be in its own file
- Use WordPress built-in functions where possible
Start with basic plugin setup and work through each section in order. Each section builds on the previous ones. Don't move to the next section until current section is working correctly.