Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $row_items = 'styleselect,|,removeformat,|,bullist,numlist,|,link,unlink,|,undo,redo';
- function tiny_mce_elements($initArray) {
- global $row_items;
- $initArray['toolbar1'] = $row_items;
- $initArray['toolbar2'] = '';
- $initArray['relative_urls'] = true;
- $style_formats = array(
- // Top level item
- array(
- 'title' => 'Subhead',
- 'block' => 'p',
- 'classes' => 'subhead',
- ),
- array(
- 'title' => 'Bold',
- 'block' => 'p',
- 'classes' => 'bold',
- ),
- );
- $initArray['style_formats'] = json_encode( $style_formats );
- // $initArray['theme_advanced_blockformats'] = 'p,h1,h2,h3';
- // $initArray['theme_advanced_styles'] = 'Heading=intro, Subhead=h2, Feature Link=feature-link';
- return $initArray;
- }
- add_filter('tiny_mce_before_init', 'tiny_mce_elements');
- function my_toolbars( $toolbars ) {
- global $row_items;
- // unset existing formats
- unset($toolbars['Basic']);
- unset($toolbars['Full']);
- $row_1 = str_replace('|', '', $row_items);
- $row_1 = explode(',', $row_1);
- $toolbars['Full'][1] = $row_1;
- // return $toolbars - IMPORTANT!
- return $toolbars;
- }
- add_filter('acf/fields/wysiwyg/toolbars', 'my_toolbars');
- function tiny_css($wp) {
- $wp .= ',' . TDIR . '/assets/css/styles.min.css';
- return $wp;
- }
- add_filter( 'mce_css', 'tiny_css' );
- // format the content
- function format_output($content) {
- $content = preg_replace('/<p>\\s*?(<iframe.*?><\/iframe>)?\\s*<\\/p>/s', '<div class="iframe">$1</div>', $content);
- return $content;
- }
- add_filter( 'the_content', 'format_output', 10 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement