Adding td-modal-image to all images inside posts?

Posted in: Newsmag
Post count: 15

Hi Tagdiv-Team,

I switched my blog https://linuxundich.de to Newsmag a couple of days ago. Step by step I work through a couple of things, which need to be fixed. Before Newsmag I used a lightbox Ppugin, which work “automagically”. With Newsmag I would have to edit every post, edit each image and set the modal flag. In terms of code, I need to make out of…

http://pastebin.com/raw/VVcnUvSn

//Edit: No matter what I do, it looks like it’s not possible to paste the code into the forum, without interpreting it. I transfered the code into a pastebin. Sorry.

In other words, adding “td-modal-image” to each image class. Since I published more than 1000 postings, editing all posts would be quite a challenge. So my question is: Do you know by accident some mysql magic, which will do this in seconds instead of days? My mysql knowledge is ok, but not that good.

Thanks,
Christoph

  • This topic was modified 10 years by Chrissss.
  • This topic was modified 10 years by Chrissss.
  • This topic was modified 10 years by Chrissss.
Post count: 94

Hi
have you tried with the search and replace plugin to make changes into the db?

Post count: 15

I think, i found a solution:

First i removed in every post the tag, since I tested the tag in a couple of postings. This way i won’t add it a second time…

update wp_posts set post_content = replace( post_content, 'td-modal-image', '');

Add the tag to every image…

update wp_posts set post_content = replace( post_content, '<img class="', '<img class="td-modal-image ');

It looks like it worked.

Post count: 6535

Hi

Glad you could manage to solve it.
The theme have an option which add automatically the td-modal-image on each image from posts content: http://screencast.com/t/jM3OqU0hIk

Thanks!

Post count: 15

And once again I’m to blind to find the feature. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.