I have problem when edit an news in post editor, and set the images from editor align left and open site, i cannot see the image in left said.
How can set the post style from editor not from style
add_editor_style allows theme developers to link a custom stylesheet file to the TinyMCE visual editor.
You'll want to duplicate many (if not all) of your styles from the front-end to be included in that file. Then editing in the visual editor will look more like your front-end css.
The problem is more likely that you don't have a alignleft
class in your front-end stylesheet. wp_print_styles will give you an opportunity to add custom inlined styles.
add_action('wp_print_styles', function() { ?>
<style>
/**
* 4.0 - Alignment
*/
.alignleft {
float: left !important;
margin: 6px 28px 28px 0;
}
.alignright {
float: right !important;
margin: 6px 0 28px 28px;
}
</style>
<?php
});
If you literally want to put the editor styles on the front-end (which nobody said ever) then just wp_enqueue_scripts.
add_action('wp_enqueue_scripts', function() {
wp_enqueue_style('editor-styles', includes_url('/css/editor.css'));
});
css
definitons for thealignleft
class that the added image has.