![]() |
PHP guys - help, please
Good morning board. As if I wasn't bald enough already, I'm trying to modify my blogs and coming across a problem...
At the moment I have a lot of posts with thumbnail images that, when clicked, just are linked to themselves i.e. bringing up that image in a new window. What I'm after is a way of modifing wordpress so that when the image is clicked, the clicker gets sent to a specific URL. I have found the regex that selects the <a href... through to the /a> and can change it but I need a way to keep the <img src...> the same. Allegedly the code below in your template can be used to remove the img src - can it be modified to change the a href but keep the img src? PHP Code:
Cheers M. |
You can play with '<a href="([^"]+)">([^<]+)<\/a>' and see what you can do with it. Too tired/lazy to code it up.
|
so you want us to help you remove all the "link codes" in your images ... neat
|
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
I mean, It's such a forgiving environment ... why wouldn't you pull some bullshit code and pisson'em like that.
It's a great place for friends and shit. Cool, yeah |
Quote:
|
Code:
^<a[^>]*(http://[^"]*)[^>]*>([ 0-9a-zA-Z]+)</a>$ |
I was passing through at 4:30AM - just felt obligated to point out that the regex posted was very weak.
Now, the regex posted by fris is a hell of a lot better - it actually copes with real world scenarios. I'm sorry if you don't like me pointing out what strikes me as non-optimised code. Rubbing each other's nuts helps noone ;) |
Bump for php coders
|
Quote:
|
Quote:
|
Mmmm... interesting!
|
regex gives me heartburn and I only fuck with it while on the clock. :)
|
Thanks Fris - it worked a treat and is much appreciated. And thanks for all for helping out (even FartFly!)
M. |
Quote:
|
All times are GMT -7. The time now is 10:09 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123