Add new styles to format menu / array in tinymce editor

Posted in: Newspaper
Post count: 46

Hello.
I need to add custom styles in the post / page editor via the ‘formats’ dropdown.

There is already a formats dropdown and all of the ways I tried to add to it just create a second ‘formats’ dropdown with the same options as the first.

Is it possible to add to the array somewhere and manually add my styles?

Post count: 35449

Hi,

In order to make some formats dropdown you need to go in
\wp-content\themes\Newspaper\includes\td_config.php
https://www.screencast.com/t/LCmimmAa
Example https://www.screencast.com/t/4hPf2dzS
https://www.screencast.com/t/tVuLeB6MV
Hope this will help you.

Thank you.

Post count: 46

Thanks for the reply. Can I add this via a child theme so it’s not overwritten with theme updates?

Post count: 46

Also, where do I place the css for the styling? In ‘editor-style.css’?

Post count: 46

Don’t worry. I worked out the styling will come from the standard css file
However, I can’t get a copy of the file in the child theme to work, only in the main theme, which will be overwritten with updates.
Can i make it work with the child theme?

Post count: 35449

Hi,

Please read our documentation about child theme, here you’ll find the files you can set in the child and how to set them ->https://forum.tagdiv.com/the-child-theme-support-tutorial/
Also you can set the css directly in Newspaper>Theme panel>Custom code>Custom css, in this way you’ll not lose the css after update.

Thank you.

Post count: 77

Hi Calin, I follow up on this topic as I want to achieve the same result as 3ftDeep but I have problems to make it work.

I understand child theme and custom css no problem. But I have problem to make the custom format appear on the Format Menu.

Can you confirm it’s possible to basically add only this :
td_api_tinymce_formats::add('td_text_highlight_test22',
array(
'parent_id' => 'td_text_highlight',
'title' => 'Test22',
'classes' => 'test22',
'inline' => 'span'
));

In this file : Newspaper-Child\includes\td_config.php (where td_config.php only has the code above ?)

Post count: 77

So basically my question is : “Is there a way to add a custom format without altering the Newspaper original td_config.php ?” Because after every update it’ll be erased…

Post count: 35449

Hi,

Unfortunately the td_config.php will not work in child theme, you’ll need to make the change in theme file after each update, sorry for the inconvenience.

Thank you for your understanding.

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.