Monday, March 19, 2012

business catalyst blog post list with image

This is a code on how to get the image of your blog post description put it in the bloglist.

jQuery(".blog-post").each(function(){
 var thisUrl=window.location.href;
 var splitThisUrl=thisUrl.split(".com/");
 var uri=jQuery(this).find(".post-body a").attr("href");
 var imgUrl=splitThisUrl[0]+".com"+uri;
 jQuery(this).find(".imgCont").load(imgUrl+" .post-body img:eq(0)");
});


How to use:
In the Blog Post List Layout put a div that will serve as the container of the image. In this example I named it .imgCont.

No comments:

Post a Comment