by Ange Tuteur October 12th 2015, 1:40 pm
Hi,
Sorry for the wait, I've been busy. Add the following to your stylesheet :
- Code:
.last-ajax-posts {
font-size:13px;
font-family:Arial, Verdana, Sans-serif;
}
Then go to Modules > JavaScript codes management and create a new script
Placement : In all the pages
- Code:
window._getNewest = function(o) {
if (!o.node) return false;
if (!o.forum) o.forum = 1;
if (!o.amount) o.amount = 5;
o.node = document.getElementById(o.node);
if (o.node) {
$.get('/f' + o.forum + '-?change_version=prosilver', function(d) {
var last = $('.row .lastpost:has(a[href^="/t"])', d), content = document.createElement('DIV'), i = 0;
for (; i < o.amount; i++) {
if (!last[i]) break;
else content.appendChild(last[i]);
}
o.node.appendChild(content);
});
}
};
After this, you can add the following to widget :
- Code:
<div id="topicbox-1" class="last-ajax-posts"></div>
<script type="text/javascript">
_getNewest({
forum : 1,
amount : 3,
node : 'topicbox-1'
});
</script>
If you're going to have multiple boxes, make sure to replace the 1 in topicbox-1 by another number. At the bottom are some settings :
forum : The ID of the forum you want the topics from.
amount : The amount of topics you want to get.
node : The ID of the container you want to load the topics into.
To style any of the content, just use the following selector(s) :
- Code:
.last-ajax-posts .lastpost {
}
( that is for the container of each topic )
If you have the avatars for lastposts enabled under Display > Structure and Hierarchy, the avatars will also display in this widget. The rest is up to you.