Skip Navigation

[Escalated to 2nd Tier] Custom MCE-Button in an Repeatable Fieldgroup Field with Visual editor

This support ticket is created 4 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by Luo Yang 4 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1810541

Hi there,

I tried to add CSS-class-format-buttons for the Visual Editor. It works fine with the Default Editor, but I need them in a Custom Field "WYSIWYG", which is in an repeatable field group.

Can You please help me with this issue?

Thanks, Alex

My Code only works in the Default Editor but not within the one of a repeatable field group:

function kb_mce_buttons_3( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_3', 'kb_mce_buttons_3' );

function kb_mce_before_init_insert_formats( $init_array ) {
$style_formats = array(
// Externer Linkk
array(
'title' => 'Externer Link',
'selector' => 'a',
'classes' => 'externer-link',
),
array(
'title' => 'Interner Link',
'selector' => 'a',
'classes' => 'interner-link',
),
);
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
}
add_filter( 'tiny_mce_before_init', 'kb_mce_before_init_insert_formats' );

#1810967

Hello,

I have tried your codes in my localhost with a fresh WP installation + the latest version of Toolset plugins, it does not work in WP Default Editor, I don't see any extra button in the WP Default Editor, please provide detail steps to duplicate the same problem, and take a screenshot for what you are going to achieve.

#1811271
Bildschirmfoto 2020-10-14 um 16.06.12.png
Bildschirmfoto 2020-10-14 um 16.06.00.png

Hi Luo,

here you can see what happens with the default WP-Editor but not with the Toolset-Editor with this function. Both Screenshots are from the same CPT. The second one is from the default-post-editor-field, the first one is form the repatable fieldgroup underneath. What I need is an easy option to add a style-class to a link in the editor text.

Thanks Alex

#1811941
Classic-Editor.JPG

I have tried it again in my localhost with a fresh WP installation + the latest version of Toolset plugins, with below steps:
1) Copy/paste your custom codes into theme file functions.php
2) Create a post with classic editor, it does not work in WP Default Editor, I don't see any extra button in the WP Default Editor, see my screenshot: Classic-Editor.JPG
please provide detail steps to duplicate the same problem
If it needs other plugin or theme, please provide downloadable URL for those plugin/theme

#1812223

Hi,

I did exactly the same an it works. What can i say?

Function in function.php

Can I provide you access? There are no specific Plugins, that can conflict with the editor. I deactivated Visual Composer and it makes no difference.

https://codex.wordpress.org/TinyMCE_Custom_Styles

#1813381

Since it is a custom codes problem, please provide a copy of your website in below private message box, also point out the problem post URL and where I can edit your PHP codes, I need to test and debug it in my localhost, thanks

#1813623

I can download the files and download the missing installer.php from your website directly, trying to duplicate the same problem in my localhost, will update here if find anything

#1813643
Arbeitsschutz.JPG

I can install your database dump file in a fresh WP installation + the latest version of Toolset plugins, tried these steps:
1) Copy/paste the same codes you mentioned in post into theme file functions.php:
https://toolset.com/forums/topic/custom-mce-button-in-an-repeatable-fieldgroup-field-with-visual-editor-2/#post-1810541

2) Open the post URL you mentioned above:
hidden link
See my screenshot Arbeitsschutz.JPG, there isn't any format select menu in the default WP editor

So please provide a full copy of your website in below private message box.
https://toolset.com/faq/provide-supporters-copy-site/

#1813735
Bildschirmfoto 2020-10-16 um 13.37.53.png
Bildschirmfoto 2020-10-16 um 13.38.06.png

perhaps you need to open the second button-line:

#1815799

Thanks for the details, I can see the problem in my localhost, will update here if find anything.

#1815807

I can duplicate the same problem in my localhost with a fresh WP installation, have escalated this issue, will update here if there is anything news.