Customization Guide (Best Practices for Developers)
This guide covers recommended methods for safely and efficiently customizing Movie Engine.
Follow these best practices to ensure your changes are scalable, maintainable, and update-safe.
๐ Core Principles
When customizing Movie Engine, always follow this priority order:
- Use Hooks (Actions & Filters) โ First choice
- Override Templates โ When structure changes are needed
- Custom Plugin / Functions.php โ For logic extensions
- Avoid Editing Core Plugin Files โ
๐ Use Hooks (Recommended)
Hooks are the safest and most flexible way to customize Movie Engine.
Why use hooks?
- No risk during plugin updates
- Easy to manage and remove
- Works across themes
Example
add_action('movie_engine_before_player', function() {
echo '<div class="notice">Content may not be suitable for all audiences.</div>';
});
๐ Use hooks for:
- Adding banners, ads, notices
- Injecting custom sections
- Modifying output with filters
๐งฉ Template Overrides
Use template overrides when you need to change the layout or HTML structure.
๐ Override Path
your-theme/movie-engine/
Example
your-theme/movie-engine/archive-movie.php
your-theme/movie-engine/single-movie.php
Best Practices
- Copy only the files you need
- Keep overrides minimal
- Re-check after plugin updates
โ๏ธ Use a Custom Plugin (Recommended for Advanced Users)
Instead of adding everything to functions.php, create a custom plugin.
Why?
- Keeps logic separate from theme
- Safer when switching themes
- Better for scaling
Example Structure
wp-content/plugins/my-movie-engine-custom/my-movie-engine-custom.php
๐ฏ Combine Hooks + Templates (Power Approach)
For advanced customization:
- Use templates โ for layout
- Use hooks โ for dynamic content
๐ Example:
- Override
single-movie.php - Add extra sections via
movie_engine_single_movie_content
๐ฐ Monetization Customization
Movie Engine provides multiple hooks for ads and revenue.
Best Practices
- Use:
movie_engine_ad_player_topmovie_engine_ad_player_bottom
- Avoid hardcoding ads in templates
๐ This keeps ads flexible and manageable.
๐ Membership & Access Control
Use filters to control premium content:
movie_engine_is_premiummovie_engine_is_restrictedmovie_engine_preview_duration
Example
add_filter('movie_engine_preview_duration', function($seconds) {
return 120; // 2-minute preview
});
๐จ Styling & UI Customization
Recommended Approach
- Add styles in your theme:
style.css
or enqueue custom CSS:
wp_enqueue_style('custom-style', get_stylesheet_directory_uri() . '/custom.css');
Avoid
- Editing plugin CSS directly โ
โก Performance Best Practices
- Avoid heavy queries inside hooks
- Cache expensive operations
- Minimize DOM-heavy injections
- Use lazy loading for media
๐ Update-Safe Strategy
To keep your customizations safe:
- โ Use hooks whenever possible
- โ Use template overrides properly
- โ Keep custom code separate
- โ Never edit plugin core files
๐งช Debugging Tips
- Enable WordPress debug:
define('WP_DEBUG', true);
- Check:
- Hook priority issues
- Missing template overrides
- Conflicts with theme/plugins
๐ฆ Developer Workflow (Recommended)
- Create a child theme or a custom plugin
- Add hooks for small changes
- Override templates for layout
- Test on staging site
- Optimize performance
๐ Summary
| Task | Recommended Method |
|---|---|
| Add content | Hooks |
| Modify data | Filters |
| Change layout | Template override |
| Add logic | Custom plugin |
| Styling | Theme CSS |
