Can I add tinyMCE in wordpress to the dropdown list

Desperate to find a way to add some styles to the format, pull it into tinyMCE. I developed how to cut out the ones I don't need with

    <?php
add_filter('tiny_mce_before_init', 'set_blockformats');

function set_blockformats($settings)
{

    $settings['theme_advanced_blockformats'] = "p,h3";

    return $settings;
}

?>

but if I try to add my own style, let's say <div class="someClass">I just get a blank line in the drop-down list that doesn't seem to affect the HTML of the selected text.

Where am I going wrong?

+3
source share
2 answers

, . - . ( , , , css, custom_css):

// Style formats you want to add
formats: [{
    title: 'Title1'
}, {
    title: 'CSS_1',
    block: 'p',
    classes: 'class1',
    exact: true
}, {
    title: 'CSS_2',
    block: 'p',
    classes: 'class2',
    exact: true
}, {
    title: 'CSS_§',
    inline: 'span',
    classes: 'class3',
        exact: true
}],

PHP wordpress :

$settings['formats'] = "[{
        title: 'Title1'
    }, {
        title: 'CSS_1',
        block: 'p',
        classes: 'class1',
        exact: true
    }, {
        title: 'CSS_2',
        block: 'p',
        classes: 'class2',
        exact: true
    }, {
        title: 'CSS_§',
        inline: 'span',
        classes: 'class3',
            exact: true
    }]";
+1

, blockquote, . AFAIW. , , blockquote !

0

Source: https://habr.com/ru/post/1774294/


All Articles