add_theme_support('align-wide');.wp-block-group.alignwide .wp-block-group__inner-container {
width: 1200px;
max-width: calc(100% - 40px);
margin: auto;
}
add_theme_support('align-wide');.wp-block-group.alignwide .wp-block-group__inner-container {
width: 1200px;
max-width: calc(100% - 40px);
margin: auto;
}
// Editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => 'Beige',
'slug' => 'mahii-beige',
'color' => '#eee0d0',
),
array(
'name' => 'Orange',
'slug' => 'mahii-orange',
'color' => '#f37646',
),
array(
'name' => 'Blanc',
'slug' => 'mahii-blanc',
'color' => '#fff',
),
array(
'name' => 'Noir',
'slug' => 'mahii-noir',
'color' => '#141819',
),
)
);
Pour designer les blocks dans l’admin aussi !
function mytheme_enqueue_block_editor_assets() {
// Charger le fichier CSS personnalisé dans l'éditeur Gutenberg
wp_enqueue_style(
'mytheme-editor-styles', // Nom du handle
get_theme_file_uri('/editor-style.css'), // Chemin vers le fichier CSS
false, // Pas de dépendances
'1.0', // Version du fichier
'all' // Media
);
}
add_action('enqueue_block_editor_assets', 'mytheme_enqueue_block_editor_assets');// Custom style Editor only
function custom_gutenberg_editor_style() {
echo '<style>
.interface-complementary-area__fill,
.interface-complementary-area__fill > div {
width: 480px !important;
min-width: 480px;
}
</style>';
}
add_action('admin_head', 'custom_gutenberg_editor_style');
function mytheme_register_block_styles() {
// Ajouter un style personnalisé "not" au bloc Groupe
register_block_style(
'core/group',
array(
'name' => 'note',
'label' => __('Note Style', 'mytheme'),
'isDefault' => false, // Optionnel : false pour ne pas le définir comme style par défaut
)
);
}
add_action('init', 'mytheme_register_block_styles');.wp-block-group.is-style-note {
background-color: #f0f0f0;
border: 2px dashed #ff0000;
padding: 20px;
color: #333;
}