SimplePie 1.3.1 is now available. Upgrade now!

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

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



class SimplePie {
	set_author_class ( [string $class = 'SimplePie_Author'] )

Allows you to add new methods or replace existing methods in the SimplePie_Author class.

Learn more about extending classes in PHP:


  • Available since SimplePie Beta 3.



The new class for SimplePie to use.


Replace a method and add a method

// Create a new class that extends an existing class
class SimplePie_Author_Extras extends SimplePie_Author {
	This is an example of adding a new method to an existing class.
	function get_name_backwards()
		return strrev($this->get_name());
// Let's do our standard SimplePie thing.
$feed = new SimplePie();
<?php foreach ($feed->get_items(0,5) as $item): ?>
	<h4><a href="<?php echo $item->get_permalink()?>"><?php echo $item->get_title()?></a></h4>
	<p><small><?php echo $item->get_date('j F Y, g:i a')?></small></p>
	<p><?php echo $item->get_description()?></p>
	if ($author = $item->get_author())
		echo $author->get_name_backwards();
	<hr />
<?php endforeach; ?>

See Also

reference/simplepie/set_author_class.txt · Last modified: 2011/03/05 19:56 (external edit)