Optimizations for a local WordPress theme development environment.
You can install the package via Composer:
composer require mindkomm/theme-lib-environment-dev
By default, the development environment:
- Disables heartbeat.
- Adds a custom 🚀 favicon for development enviroments.
To activate the feature, use the following code:
functions.php
if ( is_dev() ) {
$wpdev = new Theme\Environment\Development\WordPress();
$wpdev->init();
}
For the development favicon feature to work well, you’ll need to render your favicons through a render_theme_favicon()
function. The development favicon feature will unhook your render_theme_favicon
function from wp_head
and add its own code.
functions.php
/**
* Add the theme favicon into theme head
*/
add_action( 'wp_head', 'render_theme_favicon' );
/**
* Render favicons.
*
* This needs to be a separate function so that it can be unhooked.
*/
function render_theme_favicon() {
Timber\Timber::render( 'favicons.twig', Timber\Timber::get_context() );
}
Redirects all emails sent through wp_mail to a certain email address.
if ( is_dev() ) {
$wpdev = new Theme\Environment\Development\WordPress();
$wpdev->redirect_emails( '[email protected]' );
}
Filters the recipient email for WooCommerce emails.
functions
if ( is_dev() ) {
$woodev = Theme\Environment\Development\WooCommerce();
$woodev->set_email_recipient( '[email protected]' );
}
This is a library that we use at MIND to develop WordPress themes. You’re free to use it, but currently, we don’t provide any support.