Skip to content

Instantly share code, notes, and snippets.

@mototeam
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mototeam/27ee82c87566a5235c44 to your computer and use it in GitHub Desktop.
Save mototeam/27ee82c87566a5235c44 to your computer and use it in GitHub Desktop.
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