AJAX news feed script - display only latest post/s

Replace the square bracket [] text with the relevant elements. This is based on the existing AJAX requests found in the TOOLTIPS AREA.

ALL BLOG NEWS FEED

Maxrows = number of posts to load

jQuery("[TARGET]").load('/page/news/ajax-stream-all.html?maxrows=3', function(data){

});

SINGLE BLOG VERSIONS

  • Set to show only the latest post
  • Appends READ MORE to the link*

<script type="text/javascript">// <![CDATA[
jQuery("[TARGET]").load('[ADD AJAX STREAM URL HERE]', function(data){
    var list = $('[TARGET] ul');
    $("[TARGET] li:gt(0)" ).remove();
    $("[TARGET] li").each(function(){
        $(this).find('.cmsTitleAndTextNoPrice').append('<a href="'+$(this).find("a").attr("href")+'" class="bloglink">READ MORE</a>');
    });
});
// ]]></script>

* NOTE you can now add a read more link via the OPTIONS tab on the page...

  • if you want a version with the top 5, change the number value in this line to the following (first item starts at 0 so 5th = 4);

$("[TARGET] li:gt(4)" ).remove();

  • Version with a reversed list

<script type="text/javascript">// <![CDATA[
jQuery("[TARGET]").load('[ADD AJAX STREAM URL HERE]', function(data){
    var list = $('[TARGET] ul');
    var listItems = list.children('li');
    list.append(listItems.get().reverse());
    $("[TARGET] li:gt(0)" ).remove();
    $("[TARGET] li").each(function(){
        $(this).find('.cmsTitleAndTextNoPrice').append('<a href="'+$(this).find("a").attr("href")+'" class="bloglink">READ MORE</a>');
    });
});
// ]]></script>

Index Next