You will need to add the list of Name to show=classname to the TinyMCE config using the filter tiny_mce_before_init. More info.
I was having this problem for a long time, azaozz’s response helped me figure out what to do:
I couldn’t figure out how to add another css file to tinymce using the filter so I did a little digging and found that there is a file in public/wp-includes/js/tinymce/ called wordpress.css. I added the classes I wanted to this css file and they now show up in the post / page editor.
I don’t know how well this method will hold up to an upgrade (I have a feeling it wont), but I couldn’t find any information on the net about how to use the tiny_mce_before_init filter.
Ned
Hi,
I am really struggling to figure this out. I don’t really want to edit a core file that might be changed in an update. Asaozz (or anyone else!), thank you for your comment above, but please could you spell out in a little more detail how to add a custom class name to the class dropdown on the Insert/Edit link dialog.
Many thanks!
Tom
I have exactly the same situation.
Can anybody help please?
G’day,
I just found this plugin
http://www.n7studios.co.uk/2010/03/07/wordpress-insert-link-class-plugin/
It adds class names to the editor, then all you have to do is add the class to your theme CSS.
Working like a charm for me.
HTH,
=-)
The plugin above doesn’t seem to be working right now (it looks pretty new), but depending on what you want to do, I found another nice plugin that might work for you.
http://ww.wp.xz.cn/extend/plugins/link-indication/
Which allows you to automatically assign custom CSS classes for links based on file extension or domain.
I couldn’t find the TinyMCE file listed above, nor any other file that referenced the built-in classes.
Create a stylesheet in your theme directory called ‘tinymce.css’ (for example). Add your desired link classes in there, like so:
a.myClass {}
Then, in your functions.php add the following:
function addTinyMCELinkClasses( $wp ) {
$wp .= ',' . get_bloginfo('stylesheet_directory') . '/tinymce.css';
return $wp;
}
if ( function_exists( 'add_filter' ) ) {
add_filter( 'mce_css', 'addTinyMCELinkClasses' );
}
Hope that helps.