Jump to content

Teucer90

Member
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Teucer90's Achievements

Level 2

Level 2 (2/20)

2

Reputation

  1. This code worked for me to alphabetize blog posts based on title name: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ if( $('.blog-item').length != 0 ){ var categories = []; $('.blog-item').each(function () { categories.push({ categoryName: $(this).find('.blog-title').html(), listItem: $(this) }); }); categories.sort(function(a,b) { var c = a.categoryName.toUpperCase(); var d = b.categoryName.toUpperCase(); return (c > d) ? 1 : ((d > c) ? -1 : 0); }); $.each(categories, function(index, object){ object.listItem.appendTo(object.listItem.parent()); }); } }); </script> The only issue is that the pagination links at the bottom won't be alphabetized as well, so I had to hide them. If anyone has solved this problem I'd love to see that solution
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.