Link to home
Start Free TrialLog in
Avatar of badwolfff
badwolfffFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How do I change a set of a href url based on a prefix + extracted middle bit from existing link + suffix?

Hi,

I am using a flickr plugin in wordpress which shows icons of my flickr photos in the footer.
There is one problem though. It open the links like this:

http://farm1.staticflickr.com/304/19078206629_4cfbe2d72c_b.jpg

whereas I need it to open

https://www.flickr.com/photos/134303126@N05/19078206629/in/dateposted/

The prefix https://www.flickr.com/photos/134303126@N05/
and the suffix /in/dateposted/
will be the same for all images in the gallery

From the name of the file, for example: 19078206629_4cfbe2d72c_b.jpg I need to extract the first part (19078206629) and insert in the middle of the prefix.

The gallery is in a ul > li > a structure so I need to run an "each" jquery on the set and make sure that on click the link that is opened is prefix + the initial part of jpg name till before the _ + suffix

Please help as I have tried a few things but I can't get it to work right. I would like to achieve this via jQuery please.

thanks
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial