SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » get_favicon()



class SimplePie {
	get_favicon ()

Returns the favicon image for the feed's website. These are supposed to be 16×16, although I've seen them be 32×32 in certain browsers (IE, Safari).


  • Available since SimplePie Beta 3.
  • $alternate parameter was removed in 1.0 RC2.


Use CSS to add the favicon to each item's title

$feed = new SimplePie();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en">
	<title>Sample SimplePie Page</title>
	<style type="text/css">
	h2.title {
		padding:0 0 0 20px;
		background:transparent url(<?php echo $feed->get_favicon(); ?>) no-repeat 0 1px;
	<div class="header">
		<h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
		<p><?php echo $feed->get_description(); ?></p>
	<?php foreach ($feed->get_items() as $item): ?>
		<div class="item">
			<h2 class="title"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
			<?php echo $item->get_description(); ?>
			<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
	<?php endforeach; ?>

See Also

reference/simplepie/get_favicon.txt · Last modified: 2011/03/06 03:56 (external edit)