Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 格式选择器中未显示自定义样式格式颜色_Php_Css_Wordpress_Tinymce - Fatal编程技术网

Php 格式选择器中未显示自定义样式格式颜色

Php 格式选择器中未显示自定义样式格式颜色,php,css,wordpress,tinymce,Php,Css,Wordpress,Tinymce,选择格式时,编辑器颜色中的单词将更改。功能正常。将显示所有选择器,并将其应用于选定对象 但是选择器的颜色也需要根据要设置的颜色而有所不同。如tinymce示例所示。这里的选择器是红色的 我使用的代码是: $color = array( 'title' => "Light Grey", 'inline' => 'span', 'styles' => array('color'=>'#232323'), 'wrapper

选择格式时,编辑器颜色中的单词将更改。功能正常。将显示所有选择器,并将其应用于选定对象

但是选择器的颜色也需要根据要设置的颜色而有所不同。如tinymce示例所示。这里的选择器是红色的

我使用的代码是:

$color = array(
        'title' => "Light Grey",
        'inline' => 'span',
      'styles' => array('color'=>'#232323'),
      'wrapper' => false,
        );
它只是在选择器中显示全部黑色。但它在编辑器的文本中运行良好。选择格式后,颜色将更改

包装代码如下:

    function atg_mce_buttons_2( $buttons ) 
  {
    array_unshift( $buttons, 'styleselect' );
    array_unshift( $buttons, 'fontsizeselect' );
    return $buttons;
  }

  function atg_mce_before_init( $settings ) 
  {


    $style_formats = array(

      array(
        'title' => 'Content Heading',
        'block' => 'h2',
        'classes' => 'h2'
        ),
      array(
        'title' => 'Content Sub Heading',
        'block' => 'h5',
        'classes' => 'h5'
        ),
      array(
        'title' => 'Paragraph',
        'block' => 'p'
        ),
      array(
            'title' => 'Red Uppercase Text',
            'inline' => 'span',
            'styles' => array(
                'color'         => 'red', // or hex value #ff0000
                'fontWeight'    => 'bold',
                'textTransform' => 'uppercase'
            )
        )

      );
    $settings['style_formats'] = json_encode( $style_formats );

        return $settings;
      }
    add_filter( 'tiny_mce_before_init',  array(&$this,'atg_mce_before_init' ));
    add_filter( 'mce_buttons_2',  array(&$this,'atg_mce_buttons_2' ));

我的代码似乎很好。正如我所提到的,它也工作得很好。编辑器中选定的文本正在更改颜色。只是选择器是黑色的,而不是它们各自的颜色。你能显示包装代码吗?我已经添加了包装代码。我还尝试了示例中的代码。示例中的红色上部文本也不会显示为红色,但在选定的文本中有效。