• Hi,

    I have been running a photoblog for some time now, and have several hundred posts. All is well. I am now developing a wordpress theme, and I would like to apply it to my existing site.

    The theme is based on the boostrap 3 framework, and I now wish to make all images responsive. The framework takes care of this if I add the CSS ‘img-responsive’ to the css of the <img> tag.

    How can I ‘retro’ apply the additional CSS style to the <img> tag in the posts and custom posts? Is there a wordpress function that I can use to change the styles?

    I don’t wish to go through the 100’s of posts changing the CSS for all the images, and furthermore, if I was to start working on commercial themes – I could not ask customers to go through all their previous posts!

Viewing 1 replies (of 1 total)
  • The image references are of course stored in the database. Look into running a find/replace on the db with phpMyadmin looking for all instances of “img” and replacing with “img class=”xxx”.
    Global changes to the db are risky! So I would:
    1. Make a full db back up first
    2. Make sure you fully understand what you’re doing
    3. Test the update out first on one post and check the results.

    I think there are plug ins that do this too – so you may want to look into that.

Viewing 1 replies (of 1 total)
  • The topic ‘Add CSS style to old posts’ is closed to new replies.