New Landing How can we help? Themeforest Theme Support Flexform In the toolbar, how to add custom css styles?

Viewing 15 posts - 16 through 30 (of 31 total)
  • Posted in: Flexform
  • #116329
    blaouchez
    Member
    Post count: 448
    This reply has been marked as private.
    #116438
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    I notice you have a child theme but you don´t have a functions.php inside it.
    You should create a file functions.php with the following content inside:

    
    <?php
    function custom_mce_styles( $init ) {
            $init['theme_advanced_buttons2_add_before'] = 'styleselect';
            $init['theme_advanced_styles'] = 'Impact Text=impact-text';
            return $init;
        }
    
    add_filter( 'tiny_mce_before_init', 'custom_mce_styles'  );
    
    ?>
    
    

    -Rui

    #116456
    blaouchez
    Member
    Post count: 448

    If I put this code in function.php, the WP admin is no longer accessible.

    If I create a theme function.php in my child page, the WP admin is no longer accessible.

    #116767
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Can you create and empty functions.php inside the child theme?
    That shouldn’t break the site unless exist any syntax error.

    -Rui

    #117038
    blaouchez
    Member
    Post count: 448

    It is normal that the current code does not work because it has changed since the WordPress version 3.9

    Do you know the code to use my new page “editor-style.css” style?

    #117042
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    This is the code we have in theme functions.php

    
    
    	function sf_custom_mce_styles( $args ) {
    				
    		$style_formats = array (
    		    array( 'title' => 'Impact Text', 'selector' => 'p', 'classes' => 'impact-text' ),
    		);
    		
    		$args['style_formats'] = json_encode( $style_formats );
    		
    		return $args;
    	}
    	 
    	add_filter('tiny_mce_before_init', 'sf_custom_mce_styles');
    
    

    What exactly are you trying to achieve?

    -Rui

    #117054
    blaouchez
    Member
    Post count: 448

    Rui thank you but it does not work with Felxform

    would have:

    – A “Styles” button appears in the toolbar
    – As “editor-style.css” styles appear in the toolbar

    #117059
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Try this plugin: https://wordpress.org/plugins/tinymce-and-tinymce-advanced-professsional-formats-and-styles

    You will need to remove

    <?php
    function custom_mce_styles( $init ) {
            $init['theme_advanced_buttons2_add_before'] = 'styleselect';
            $init['theme_advanced_styles'] = 'Impact Text=impact-text';
            return $init;
        }
    
    add_filter( 'tiny_mce_before_init', 'custom_mce_styles'  );
    
    ?>

    from the parent theme’s functions.php file

    – Kyle

    #117109
    blaouchez
    Member
    Post count: 448

    Thank you very much Kyle, the solution is very good and the “Format” button appears in the toolbar 🙂

    but I do not see the display style (.testStyle) that I created in “editor-style-shared-css”

    I have placed the sheet of “editor-style-shared-css” style at the root and well recognized by the plugin

    How to show my styles in the toolbar

    After that, I should be able to run 🙂

    Attachments:
    You must be logged in to view attached files.
    #117121
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    I see that you haven’t added a style for the plugin? Look at the last screenshot, you need to ‘add a new style’

    – Kyle

    #117145
    blaouchez
    Member
    Post count: 448
    This reply has been marked as private.
    #117148
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    I’m afraid it’s not our job to support plugins. Please read their documentation that explains how to set up custom styles

    – Kyle

    #117150
    blaouchez
    Member
    Post count: 448

    Yes, I understand Kyle and you have already helped me a lot, thank you very much !

    I tried to find an example but without success. I’ll look again.

    This is the only detail to finally get to this very important function for my project

    #117151
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    I used the plugin a couple of years ago and it worked, I know that you have to add the css class which you haven’t done

    – Kyle

    #117163
    blaouchez
    Member
    Post count: 448

    Sorry to insist, but as you know very well this plugin, could you just give me one example? Just to understand.

Viewing 15 posts - 16 through 30 (of 31 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register