Hi,
I want to be able to add a custom class to an inserted Link from the WYSIWYG editor, for example “lightbox”.
It would be even better if the post type of the linked content (internal links) would be applied as a class. Is there any possibility?
Thanks in advance!
This is not the fault of ACF, but TinyMCE (and a little bit of WP for stripping it down).
See: http://code.tutsplus.com/tutorials/adding-custom-styles-in-wordpress-tinymce-editor–wp-24980
Basically, you’ll need to write your own functions.php filter or install this plugin: http://wordpress.org/extend/plugins/tinymce-advanced/
Filter example:
add_filter( 'tiny_mce_before_init', 'custom_mce_before_init' );
function custom_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => 'Some Style',
'selector' => 'a',
'classes' => 'my-anchor-class',
)
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}