How can I control the HTML output of my post?
I have decided that the best solution is to just disable the visual editor, from Users -> Your Profile -> Disable visual editor when writing.
I have decided that the best solution is to just disable the visual editor, from Users -> Your Profile -> Disable visual editor when writing.
This requires two steps: 1) First, we need to hide the editor tabs, which can be accomplished easily enough using CSS. We’ll output some CSS to the admin head to do that: function hide_editor_tabs() { global $pagenow; // Only output the CSS if we’re on the edit post or add new post screens. if ( … Read more
The simplest answer is: you can use whatever stylesheet you want for the editor. editor-style.css is just the default stylesheet loaded if none is passed to add_editor_style(). This will load the specified stylesheet: add_editor_style( ‘some-stylsheet.css’ ); This will load editor-style.css: add_editor_style(); Use whatever better fits your needs. By the way, it is better practice to … Read more
In the TinyMCE plugin i wrote, my listbox wraps selected text in HTML, i do that like this.. onselect : function(v) { // Set focus to WordPress editor ed.focus(); // Get selected text var sel_txt = ed.selection.getContent(); // If no text selected if( ” == sel_txt ) return null; var active_style = toggle_styles[v]; if( ‘undefined’ … Read more
You shouldn’t call add_editor_style() directly in your functions.php file. Instead, you should wait until the plugins and themes have been loaded: add_action( ‘after_setup_theme’, ‘add_editor_style’ ); If you already have a function hooked to after_setup_theme, you can call add_editor_style() inside there instead. You then need create a file called editor-style.css and place it in your theme … Read more
To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they’re all on. If you get them all back on and the content still … Read more
I hope I understood your question right. The following code will remove the editor from the pages using particular templates: <?php function wpse242371_remove_editor_from_some_pages() { global $post; if( ! is_a($post, ‘WP_Post’) ) { return; } /* basename is used for templates that are in the subdirectory of the theme */ $current_page_template_slug = basename( get_page_template_slug($post_id) ); /* … Read more
Judging from your site’s content and the comments, you may try using the following CODE in your theme’s functions.php file. It’ll remove empty <p> </p> tags from post content: add_filter( ‘the_content’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); add_filter( ‘the_excerpt’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); function wpse_257854_remove_empty_p( $content ) { return str_ireplace( ‘<p> </p>’, ”, $content ); } However, after it removes the … Read more
It turns out that TinyMCE has it’s own autop setting, so if you kill it before the sort and then put it back you should be good to go! Check out the autop setting handling in this snippet: <script> (function($) { // by default, wpautop will be true var wpautop = true; // this function … Read more
You maybe smoking something, but it doesn’t change the fact that you are right 😉 WP image management, (or should I say TinyMCE image management) is really sub par. ImagePro might be a good solution for you. Not only does it help replacing images in editor but also resizes them and displays a server-generated resized … Read more