This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class Favicons { | |
/** | |
* The path suffix for the icons | |
* | |
* @var string | |
*/ | |
private $path_suffix = '/html/src/assets/img/favicons/'; | |
public function _init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class MC_Customize_WP_Mail { | |
private $sender_mail; | |
private $sender_name; | |
private $reply_mail; | |
private $replay_name; | |
/** | |
* Set custom sender mail and name for all sent emails | |
* and add a reply to mail and name to allow people replying to your sent emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. Generate a bunch of dummy images, for that I use http://unsample.net | |
# 2. Upload it via sftp or whatever | |
# 3. Import the images into the WordPress library using the uploaded path | |
wp media import media-to-import/* | |
# 3.1 It will import the images by generating the following prompt : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is a basic exemple on how to load assets depending on the version of the theme | |
* On a fresh delevery, it allows to refresh the assets on client sides | |
* It could have been implementeed as a class (todo) | |
* @author Maxime CULEA | |
*/ | |
add_action( 'wp', 'mc_register_assets' ); | |
function mc_register_assets() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'enqueue_block_editor_assets', 'disable_editor_fullscreen' ); | |
function disable_editor_fullscreen() { | |
if ( ! is_admin() ) { | |
return; | |
} | |
wp_add_inline_script( 'wp-blocks', "jQuery( window ).load(function() { const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } });" ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow to download a lang despite DISALLOW_FILE_MODS to true | |
* @author Maxime Culea | |
*/ | |
add_filter( 'file_mod_allowed', function ( $value, $context ) { | |
if ( $context == 'can_install_language_pack' ) { | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class MC_Template_Part_Var { | |
/** | |
* @author Maxime Culea | |
* @var MC_Template_Part_Var | |
*/ | |
public static $instance; | |
/** | |
* Vars to store | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class MC_Body_Class { | |
private static $instance; | |
private $body_class = []; | |
private $delete_class = []; | |
private function __construct() { | |
self::$instance = $this; | |
add_filter( 'body_class', array( $this, 'body_class' ) ); |