View Single Post
Old 06-26-2009, 12:14 AM  
sheepish
Confirmed User
 
Join Date: Jun 2002
Posts: 48
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:
<?php   
$content 
get_the_content();   
$postOutput preg_replace('/<img[^>]+./',''$content);   
echo 
$postOutput;   
?>
Any thoughts?

Cheers

M.
sheepish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote