Last loved track on

WordPresstuttorial – Adding this wordpress code snippet to your theme will display your most recent loved track from Make sure you change YOURUSERNAME text within the RSS url to your username.



$rss = fetch_feed('');
if (!is_wp_error( $rss ) ) :
$maxitems = $rss->get_item_quantity(1);
$rss_items = $rss->get_items(0, $maxitems);
endif; ?>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
foreach ( $rss_items as $item ) : ?>
<a href='<?php echo $item->get_permalink(); ?>' target='_blank'
title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
<?php echo $item->get_title(); ?></a>
<?php endforeach; ?>

Leave a comment