Ich versuche seit 2 Stunden einen Button in Tinymce hinzuzufügen und habe dafür Code in die ChILD Functions.php eingefügt und dann auf die js datei verwiesen. Sobald ich den Code einfüge, sind alle Buttons weg.
im original theme ordner gibt es bereits eine Datei die Shortcodes.php heißt und auch eine customcodes.js mit den anweisung was beim klicken passieren soll. aber ich will dort nicht noch was reinschreiben und wollte eigentlich meine eigene .js datei anlegen.
Der code im original template ordner lautet
Code
// Add buttons to tinyMCE
add_action('init', 'add_button');
function add_button() {
if ( current_user_can('edit_posts') && current_user_can('edit_pages') )
{
add_filter('mce_external_plugins', 'add_plugin');
add_filter('mce_buttons_3', 'register_button');
}
}
function register_button($buttons) {
array_push($buttons, "soundcloud", "youtube", "vimeo","googlemap", "buttons", "dropcap", "highlight", "tabs", "toggle", "checklist", "badlist", "blocklist", "attention", "information","error", "one_half", "one_third", "two_third", "one_fourth", "three_fourth" );
return $buttons;
}
function add_plugin($plugin_array) {
$plugin_array['soundcloud'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['youtube'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['vimeo'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['googlemap'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['buttons'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['dropcap'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['highlight'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['tabs'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['toggle'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['checklist'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['badlist'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['blocklist'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['attention'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['information'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['error'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['one_half'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['one_third'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['two_third'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['one_fourth'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
$plugin_array['three_fourth'] = get_template_directory_uri().'/functions/shortcodes/customcodes.js';
return $plugin_array;
}
Alles anzeigen
Egal welchen text in die functions.php einfüge.. sind die buttons alle verschwunden..
z.b
Code
// Add buttons to tinyMCE
add_action('init', 'add_button_tinymce');
function add_button_tinymce() {
if ( current_user_can('edit_posts') && current_user_can('edit_pages') )
{
add_filter('mce_external_plugins', 'add_plugin_tinymce');
add_filter('mce_buttons_3', 'register_button_tinymce');
}
}
function register_button_tinymce($buttons) {
array_push($buttons, "update" );
return $buttons;
}
function add_plugin_tinymce($plugin_array) {
$plugin_array['update'] = get_template_directory_uri().'/tinymce/customcodes.js';
return $plugin_array;
Alles anzeigen
ich bin am verzweifeln!!