2017-11-17 5 views
0

wp_editor와 teeny를 사용하여 내 wp 테마에 대한 사용자 정의 tinymce 막대 단추를 만들고 있지만 문제가 있습니다. hr과 charmap을 추가하면이 버튼들은 주석 막대에 나타나지 않습니다. fify_mce_buttons 필터를 통해 시간 표시 안 함

$settings = array( 
       'textarea_name' => 'xor_options[' . $editor . ']', 
       'quicktags'  => array('buttons' => 'strong,em,del,ul,ol,li,close'), 
       'media_buttons' => true, 
       'wpautop' => false, 
       'textarea_rows' => 5, 
       'editor_height' => 200, 
       'teeny' => true, 
       'tinymce' => true 
     ); 
wp_editor($xor_output, $xor_editor_id, $settings); 

가 지금은 조그만 버튼에 대한 필터를 사용하고 있습니다 :

은 wp_editor 구성입니다.

add_filter('teeny_mce_buttons', 'xor_editor_buttons', 10, 2); 
function xor_editor_buttons($buttons, $editor_id) { 

    if($editor_id != 'footer-editor') return $buttons; 

    $buttons = array( 
     'undo', 
     'redo', 
     'formatselect', 
     'bold', 
     'italic', 
     'underline', 
     'strikethrough', 
     'blockquote', 
     'bullist', 
     'numlist', 
     'outdent', 
     'indent', 
     'alignleft', 
     'alignright', 
     'aligncenter', 
     'alignjustify', 
     'link', 
     'unlink', 
     'hr', // not appears! 
     'charmap', // not appears! 
     'removeformat', 
     'fullscreen' 
     ); 

    return $buttons; 
} 

내 코드의 오류는 어디에서 발생합니까? 아니면 약간의 버그입니까? 저는 Wordpress 4.9를 사용하고 있습니다. 감사!


내가 거짓 조그만 설정

를 해결했다. 그럼 나는 배열로 tinymce를 설정했다 :

'tinymce'  => array(
      'toolbar1'  => $b, 
      'toolbar2'  => '', 
      'toolbar3'  => '', 
     ) 

여기서 $ b는 (포함 된 hr과 charmap) 필요한 모든 버튼이다. 참조 : Wordpress Developers

답변

0

을 당신이 플러그인을로드하는 데 필요한 도구 모음 단추를로드하기 전에 :

https://www.tinymce.com/docs/plugins/hr/ https://www.tinymce.com/docs/plugins/charmap/

당신은 당신의 WP 버전에 포함 된 TinyMCE에이 플러그인을 포함하는 경우 (볼 첫번째 필요 그들은 표준 WordPress 설정에 있습니다). 그런 다음 이러한 플러그인을로드 된 플러그인 목록에 추가해야합니다. 일단로드되면 툴바에 버튼을 추가하면됩니다.

add_filter('tiny_mce_plugins', array($this, 'tiny_mce_plugins'), 999); 

는 (배열은 플러그인 폴더 이름의 목록입니다) :

내가 teenymce에 대해 아무것도 알고 있지만하지 않습니다 (예를 들어)이 어떻게 워드 프레스 훅을 통해 TinyMCE에 고급로드 별도의 플러그인입니다

+0

답변 해 주셔서 감사합니다. 귀하의 솔루션이 작동하는지 모르겠습니다. 나는 다른 방법으로 해결했다. 내 업데이트 된 질문 위를 참조하십시오! –