A Theme Settings page provides greater control over design. From this panel, users can enable or disable patterns by color and by category, streamlining what appears in the Block Inserter and Site Editor.
In WP admin, go to Appearance > Powder to view Theme Settings.
Disable Patterns by Color
Disabling patterns in Powder by color can be done by adding a few lines of code to the functions.php file of a child theme. This allows developers to control which patterns are available to users in the Block Inserter and Site Editor, providing flexibility and customization over site design.
Disable Patterns – All Colors
/**
* Disable all patterns for the Base and Contrast colors.
*/
add_action( 'init', function() {
$color_options = [ 'base', 'contrast' ];
foreach ( $color_options as $color ) {
add_filter( 'pre_option_powder_setting_option_' . $color, '__return_zero' );
}
}, 1 );
Disable Patterns – Base Color
/**
* Disable all patterns for the Base color.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_base', '__return_zero' );
}, 1 );
Disable Patterns – Contrast Color
/**
* Disable all patterns for the Contrast color.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_contrast', '__return_zero' );
}, 1 );
Disable Patterns – Call to Action
/**
* Disable all patterns for the Call to Action category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_call_to_action', '__return_zero' );
}, 1 );
Disable Patterns – Content
/**
* Disable all patterns for the Content category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_content', '__return_zero' );
}, 1 );
Disable Patterns – Example
/**
* Disable all patterns for the Example category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_example', '__return_zero' );
}, 1 );
Disable Patterns – Footer
/**
* Disable all patterns for the Footer category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_footer', '__return_zero' );
}, 1 );
Disable Patterns – Gallery
/**
* Disable all patterns for the Gallery category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_gallery', '__return_zero' );
}, 1 );
Disable Patterns – Header
/**
* Disable all patterns for the Header category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_header', '__return_zero' );
}, 1 );
Disable Patterns – Hero
/**
* Disable all patterns for the Hero category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_hero', '__return_zero' );
}, 1 );
Disable Patterns – Pricing
/**
* Disable all patterns for the Pricing category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_pricing', '__return_zero' );
}, 1 );
Disable Patterns – Team
/**
* Disable all patterns for the Team category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_team', '__return_zero' );
}, 1 );
Disable Patterns – Testimonials
/**
* Disable all patterns for the Testimonials category.
*/
add_action( 'init', function() {
add_filter( 'pre_option_powder_setting_option_testimonials, '__return_zero' );
}, 1 );