A RSS News Ticker for WordPress & jQuery

It’s actually quite easy to add a horizontally scrolling news ticker using jQuery, WordPress, and Gian Carlo Mingati’s liscroll() plugin for jQuery.  There are really only two steps, so we’re skipping the full on demo this time…

1.) Include the files for liscroll() (the CSS file, javascript file, and of course jQuery itself). Then call the plugin as described in the author’s web page…

2.) Use WordPress’s built in RSS feed parsing and caching mechanisms. Simply edit the RSS URL for the feed you’d like to display, and paste the below code in your theme where you’d like the scroll bar to appear.

<?php include_once(ABSPATH.WPINC.'/rss.php'); // path to include script $feed = fetch_rss('http://yourRSSfeedhere.com/feed/'); // specify feed url $items = array_slice($feed->items, 0, 7); // specify first and last item ?>  <?php if (!empty($items)) : ?> <ul id="ticker01"> <?php foreach ($items as $item) : ?> <li><a href="<?php echo $item['link']; ?>"><?php echo $item['title']; ?></a><span><?php echo $item['pubdate']; ?></span></li> <?php endforeach; ?> </ul> <?php endif; ?> <? } ?>

To see it in action, check out PGB Associates home page (bottom)…

2 thoughts on “A RSS News Ticker for WordPress & jQuery

  1. I’ve read your instructions but can’t seem to get this going. Not sure/where to upload the liscroll files. Can you give me some more specific information?



  2. Markos, normally the liscroll files are included in the plugin – if you’ve uploaded it, you should have it on the server already. What we’re talking about is actually referencing them in the header of your theme. Normally, you can find this as “header.php” but it may vary depending on what theme you’re using.

Leave a Reply

Your email address will not be published. Required fields are marked *