Support » Fixing WordPress » PHP help, Assign class to photo from specific url source?

  • Resolved Rev. Voodoo


    OK, I have no idea if this is possible, with php, or with anything….

    I’ve got an autopost service set up through posterous so I can post by email when I’m away from computers.

    Normally I upload my own photos, and everything aligns great.

    When I upload through posterous, they host the photo and automatically post it to my WP site. Which is very cool, but they don’t allow control of photo size at all, and they don’t assign anything that I can use to control the photo.

    The photos from the service are simply <img> inside of <p> in my content class. So if I try to apply styling to those photos, I can’t get specific enough, it affects all sorts of other things from various plugins that insert images.

    Now, on to my question.

    All the photos posted by posterous come from a similar url

    img src=”” width=”500″ height=”668″/>

    the first part of the url is always the same, the last random stuff changes per picture

    Is there something I can do to assign a class to the photos based on the first static portion of the url? Or does anyone have a better idea?

    I’m contacting the service to see if they can add classes in an upgrade, but I’d love to figure something out now, on my end.

    Thanks peeps!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You could use a CSS selector, but it’ll only work for the more modern versions of the browsers…


    Would match any image that has a src starting with the above..

    Some selector examples:

    /* Starts with */
    /* Ends with */
    /* Contains */

    oh no sh$%?

    cool….I’ll have to mess around with that a bit, Thanks!

    edit-that sure did work…..cleaned my page back up, thanks for sure!

    You’re welcome.. 😉

    I’ll mark this resolved….solution works good enough for me

    well, I got this resolved quite nicely! The folks over at posterous started assigning a class <div class="posterous_autopost"> to wrap all content they send out to WP. Very nice fix for me, and everyone really!

    Good stuff.. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP help, Assign class to photo from specific url source?’ is closed to new replies.