Sorting Archive By Most Recent Date
Permalink Browser Info Environment
I have an Archive on my site, which works fine but I want current items (2014) at the top and older years below. I have tried all the sort options in the block, but nothing changes.
Is there an easy way in code I can flip the order around?
thanks - Tim
Is there an easy way in code I can flip the order around?
thanks - Tim
Type: | Discussion |
---|---|
Status: | In Progress |
I'm looking for this as well. . . . may have to get my php books out.
Hi I haven't been able to find a way to do this by adjusting the code, however I have done it with a quick bit of jquery. I added the following to the view.js in the /blocks/problog_list/templates/archive/ folder (obviously put it where it should be in a copy in the root):
Hope this helps someone in the future!
$(document).ready(function(){ $('#sidebar-archives h4').click(function(){ $('.archived_list').slideUp(); $(this).next('.archived_list').slideDown(); }); $('h4+ul').each(function(){ $(this).prev().andSelf().wrapAll('<div>'); }); var years = document.getElementById("sidebar-archives"); var i = years.childNodes.length; while (i--) years.appendChild(years.childNodes[i]); });
Hope this helps someone in the future!