I'm trying to improve a bookmarks manager/theme I've built (http://bookmarkie.waterstreetgm.org).
Right now, each post is simply a link:
<a href="http://tumblr.everlane.com/page/4">Everlane Tumblr</a>. ie: that one single link is the entire content of the_content().
Easy enough and works great. Next, I want to be able to get a screenshot of the site via WordPress.com's mShots.
Problem is, I can't seem to extract that link from the_content() and feed it into the <img src="">.
If that wasn't clear, here's what I'm trying to do:
<img src="http://s.wordpress.com/mshots/v1/the-link-extracted-from-the_content()/?w=1024" />
I've tried severalvariations on this:
$content = get_the_content();
$link = preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $content, $match);
But I can't achieve the basic task of extracting that link from the_content(). At the moment, I simply get a formatted link output. I can't find a way to grab the url instead of grabbing the whole link.
Thanks for any suggestions.
preg_match_all()returns the number of matches or FALSE on errror, your link will be in the$matcharray not in$link. – totels Nov 10 '12 at 1:04