Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Flexform › Styles for Swift Page Builder Text Block
New Landing › How can we help? › Themeforest Theme Support › Flexform › Styles for Swift Page Builder Text Block
- This topic has 8 replies, 5 voices, and was last updated 10 years by Kyle – SUPPORT.
-
Posted in: Flexform
-
July 12, 2013 at 5:47 pm #11382
If i edit a text-block using Swift Page Builder, i see the combo-box “Styles” which has one element “Impact Text”.
How can i add additional text style definitions to this combo-box to be used as predefined text styles?
Thank you
July 14, 2013 at 5:59 pm #11470What would you like changed? I’m not sure what you mean exactly
Sorry.
Thanks
BenJuly 15, 2013 at 7:23 am #11505See the screenshot. How can I add more styles to the text-editor?
Thank You
April 1, 2014 at 8:19 pm #63412I have the same question, using Dante.
April 2, 2014 at 8:40 am #63561Hi
Open up shortcodes.php and go to line 40 and find this:
function sf_custom_mce_styles( $init ) { $init['theme_advanced_buttons2_add_before'] = 'styleselect'; //First, we define the styles we want to add in format 'Style Name' => 'css classes' $classes = array( __('Impact Text', 'swift-framework-admin') => 'impact-text', __('Impact Text Large', 'swift-framework-admin') => 'impact-text-large', );
Just add another line in for e.g:
function sf_custom_mce_styles( $init ) { $init['theme_advanced_buttons2_add_before'] = 'styleselect'; //First, we define the styles we want to add in format 'Style Name' => 'css classes' $classes = array( __('Impact Text', 'swift-framework-admin') => 'impact-text', __('Impact Text Large', 'swift-framework-admin') => 'impact-text-large', __('My Custom Text', 'swift-framework-admin') => 'my-custom-text', );
Then you can add the css for .my-custom-text in your custom css.
– Kyle
April 13, 2014 at 10:53 pm #66669This would be perfect but includes> shotcode.php, I do not see this code (see screenshot)
Thanks
PierreApril 14, 2014 at 8:14 am #66755Ahh sorry, it’s different for flexform. We do this by adding some simple code to the functions.php file, or even better if you are using a child theme add it to your child theme’s function.php file:
function sf_custom_mce_styles( $init ) { $init['theme_advanced_buttons2_add_before'] = 'styleselect'; //First, we define the styles we want to add in format 'Style Name' => 'css classes' $classes = array( __('Impact Text', 'swift-framework-admin') => 'impact-text', __('Impact Text Large', 'swift-framework-admin') => 'impact-text-large', ); //Delimit styles by semicolon in format 'Title=classes;' so TinyMCE can use it if ( ! empty($settings['theme_advanced_styles']) ) { $settings['theme_advanced_styles'] .= ';'; } else { //If there's nothing defined yet, define it $settings['theme_advanced_styles'] = ''; } //Loop through our newly defined classes and add them to TinyMCE $class_settings = ''; foreach ( $classes as $name => $value ) { $class_settings .= "{$name}={$value};"; } //Add our new class settings to the TinyMCE $settings array $settings['theme_advanced_styles'] .= trim($class_settings, '; '); return $init; } add_filter('tiny_mce_before_init', 'sf_custom_mce_styles'); function sf_mce_css() { return get_template_directory_uri() . '/css/editor-style.css'; } add_filter( 'mce_css', 'sf_mce_css' );
– Kyle
April 14, 2014 at 1:59 pm #66947Perfect, thank you Kyle!
But it would be great to use in the theme function.php child page but I have an error message It would be great to use in the theme a function.php child page but I have an error message
“Fatal error: Cannot redeclare sf_enqueue_styles() (previously declared in /homez.764/storrera/www/site/wp-content/themes/flexform-child/functions.php:132) in /homez.764/storrera/www/site/wp-content/themes/flexform/functions.php on line 161”Pierre
April 14, 2014 at 2:00 pm #66951Ok I will get the developer to check this for you
– Kyle
-
Posted in: Flexform
You must be logged in and have valid license to reply to this topic.