28 Aug 2008

WordPress alignment problem

Brief News No Comments

So like all the other word press and coding fanatics I upgrade word press every time there's an upgrade available, thinking I'm going to improve user ability. WP has definitely improved in many areas, although some areas were cut with a fucking meat cleaver. The image icon in your tool bar is now gone, and you have to rely on the image uploader gallery to manage your images. Some of the features in the new gallery are pretty nice to have, for example testing the path of outside images being called from another source other then uploading it through WP. The resizing and aligning options which would be a great tool if it actually worked. I initially assumed that the problems that resulted in using the image tool was to bad coding. So  for those of you that have driven your head through your monitors while spending an hour trying to align your post perfectly, here's that actual reasoning for the issue.

After some hyper googling, I found many people had the same issues, but no one could answer the problem. The alignment issue was probably not problematic if you had WP 3 upgrades ago, or even 2 upgrades ago but now WP is using styles to govern your images, and though they might align right when your in the admin, once you preview or publish it goes to shit, thats because of your personal CSS styles in your theme. I suffered for a few months with alignment and it was definitely enough to make me not even want to use images in posts, but whats the fun in that. I have a lush and long post for God of War, telling the story through all of the games since conception and could use no images due to this alignment nightmare. I managed to find a forum which lead me to this page, in issue number 9 you will see theres this snippet of code, which is I believe to be the original snippet of code from a Basic WP theme.

What you do is take this code and paste it and possibly revise it based on your code. In my style sheet I labeled that area with "POST FORMATTING" so it was easy to mange later. I took the code below and pasted it along with what was there just as test to see what it would do and it definitely helped. Images are aligning with little difficulty and now the image tool wich seemed like a conscented kick to the balls everytime I used it, is now worth its weight in wood, but still not gold, could use some improvments still, im sure 3.0 is close by.

Remeber to save your original style sheet for safe keeping, so you don't butcher your site overnight. Visit the instructions page if you need some assistance. Here's another good follow up link to formatting your images in posts once it works.

img.centered { display: block; margin-left: auto; margin-right: auto; }

img.alignright { padding: 4px; margin: 0 0 2px 7px; display: inline; }

img.alignleft { padding: 4px; margin: 0 7px 2px 0; display: inline; }

.alignright { float: right; }

.alignleft { float: left; }

No Responses to “WordPress alignment problem”

Leave a Reply

Please leave these two fields as-is: