Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MotoPress - working with styles
* Plugin Name: MotoPress Change Styles Example
* Plugin URI:
* Description: This example describes how to add new styles to MotoPress objects
* Version: 0.1
* Author: MotoPress Team
* Author URI:
* License: GPL2 or later
function extendButtonStyleClasses($motopressCELibrary) {
if (isset($motopressCELibrary)) {
$buttonObj = &$motopressCELibrary->getObject('mp_button');
if ($buttonObj) {
$styleClasses = &$buttonObj->getStyle('mp_style_classes');
//add 'lavender' predefined class
$styleClasses['predefined']['color']['values']['lavender'] = array(
'class' => 'mp-button-color-lavender',
'label' => __('Lavender', 'domain'),
/* Note: add "mp-button-color-lavender" style to your stylesheet,
* for example .mp-button-color-lavender {background-color: #E6E6FA;color: #858599 !important;text-shadow: none !important;}
* For more information visit
//remove 'red' predefined class
// change basic class
$styleClasses['basic']['class'] = 'my-button';
add_action('mp_library', 'extendButtonStyleClasses', 11, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.