Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MotoPress - working with styles
<?php
/**
* Plugin Name: MotoPress Change Styles Example
* Plugin URI: http://www.getmotopress.com/
* Description: This example describes how to add new styles to MotoPress objects
* Version: 0.1
* Author: MotoPress Team
* Author URI: http://www.getmotopress.com/
* 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 http://www.getmotopress.com/blog/release-of-motopress-1-5-0-style-manager/#styling-an-object
*/
//remove 'red' predefined class
unset($styleClasses['predefined']['color']['values']['red']);
// 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.