Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Alphabetize pagination links for blog posts?


Teucer90

Question

Site URL: https://www.dealbookcompanies.com

Hi Folks,

I injected some javascript into my site to alphabetize blog posts based on blog title (see below for reference), but I'm struggling to also alphabetize the pagination links contained at the bottom of each page so I've just hidden them. Does anyone have any thoughts of how to accomplish this? Password to access "Intelligence" blog page is DealBook#123!

Code reference:

<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>

<style>
section.item-pagination {
  display: none;
}
</style>

 

Edited by Teucer90
Link to comment
  • Answers 0
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...