Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i wonder if there is a good way to create a shortcode that retrives a remote website FAV icon... i found this: ANSWER and tried to create a shortcode using it but failed (since i sux at shortcodes!)

A quote from the answer i linked up:

<?php 
$url = 'http://example.com/';
$doc = new DOMDocument();
$doc->strictErrorChecking = FALSE;
$doc->loadHTML(file_get_contents($url));
$xml = simplexml_import_dom($doc);
$arr = $xml->xpath('//link[@rel="shortcut icon"]');
echo $arr[0]['href'];
?>

Any help would be apreaciated ;)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

OK... as it sometimes goes i cant rest until i find
a way and i found a way to get the fave icon to
proeprly display using google :)

its really simple:

// here i get my URL from my custom post type
$directoryNoHttpUrl = get_post_meta( $post->ID, 'directory_url', true );

//here i clean the url from HTTP or it wont work
$directoryNoHttpUrl = str_replace("http://", "", $directoryNoHttpUrl);

// here i get the favICON using google.. 
$imgurl = "http://s2.googleusercontent.com/s2/favicons?domain=" . $directoryNoHttpUrl;

.

So.. from here on its easy.
Sorry to trouble anyone entering to help
but thanks for your intention

Cheers, Sagive.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.