In uiPress version 3.2.04 we introduced an upgrade to the class selector in uiPress. It now automatically scans all available classes in the admin area and provides you with a list to add these to your blocks.

While uiPress will automatically pick up classes in stylesheets in the admin, you may also wish to push other classes manually to this list. This is possible using a very simple hook within your functions.php file.

The following code will add three new classes to the list; ‘custom-background’, ‘custom-color’ and ‘custom-typeface’.

add_filter('uip_register_custom_class', 'add_custom_class', 1, 2);
function add_custom_class($classes)
{
   if (!is_array($classes)) {
      $classes = [];
   }

   $myCustomClasses = ['custom-background', 'custom-color', 'custom-typeface'];
   return array_merge($classes, $myCustomClasses);
}