gsxtasy
Member
Posted 15 years ago #
The main purpose of our company using Wordpress MU is for the ease of use for all people posting pages and posts. Is there an easy way to wrap text around images without editing any css or html? We need to make it easy for all authors to wrap the text around the images...they know nothing about html or css
ninjanuts
Member
Posted 15 years ago #
Hi gsxtasy
Your best bet is probably to write your own plugin that searches for images and replaces some inline styling when it finds them.
function wrapimages ($content)
{
$img_pattern = '/<img(.*?)\/>/i';
$img_replacement = '<img style="float:left;"$1\/>';
$content = preg_replace($img_pattern, $img_replacement, $content);
return $content;
}
add_filter('the_content', 'wrapimages');
the above is very crude but it's how i'd start off i guess.
cafespain
Member
Posted 15 years ago #
Or just get them to click the left-align or right-align button on the editor when they add an image.
Or pick themes that have it already written in the css file.
And if the theme doesnt wrap the images add this to it's css:
.aligncenter,
div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
.alignleft {
float: left;
}
.alignright {
float: right;
}
gsxtasy
Member
Posted 15 years ago #
Thanks for all your help...I have added that css code into the style.css file and I clicked align right on the image but its still not wrapping...any other suggestions?
Look at the default theme's css and copy that.