Pagination mess

188 views
Skip to first unread message

soulchainer

unread,
Jul 12, 2014, 8:02:00 AM7/12/14
to tumblr...@googlegroups.com
Can someone explain this?

My pagination post code:

<!-- PAGINATION POSTS -->
      {block:PermalinkPagination}
      <nav class="pagination">
        {block:PreviousPost} <!-- newer post -->
        <a class="flaticon-arrow-right post next" id="prev-post" href="{PreviousPost}" title="{lang:Next}" rel="prev prefetch">
        </a>
        {/block:PreviousPost}
        {block:NextPost} <!-- older post -->
        <a class="flaticon-arrow-left post prev" id="next-post" href="{NextPost}" title="{lang:Prev}" rel="next prefetch">
        </a>
        {/block:NextPost}
      </nav>
      {/block:PermalinkPagination}

Like you can see, in {block:PreviousPost} , I fill the {PreviousPost} href. And in {block:NextPost} the {NextPost} href, ok? Supposedly, according documentation, PreviousPost is newer post and NextPost is older post. Aha.
And, like you see, I have previous link with id="prev-post" and next-link with id="next-post". Logical, no? And same for Page Pagination, with -page suffix. Note: you can get confused because in previous block I use right arrow and next class and in next block I used left arrow and prev class, for align the link icon arrows in the opposite site. The reason of this is explained after the next code.

Well, here is someone that can explain WHY this next funtions ONLY work well this way:

function goToPrev() {
  {block:Pagination}{block:PreviousPage}
  $('#prev-page').trigger('click');
  {/block:PreviousPage}{/block:Pagination}
  {block:PermalinkPagination}{block:NextPost}
  $('#next-post').trigger('click');
  {/block:NextPost}{/block:PermalinkPagination}
};
function goToNext() {
  {block:Pagination}{block:NextPage}
  $('#next-page').trigger('click');
  {/block:NextPage}{/block:Pagination}
  {block:PermalinkPagination}{block:PreviousPost}
  $('#prev-post').trigger('click');
  {/block:PreviousPost}{/block:PermalinkPagination}
};

Because this IS CRAZY. Like you can see in this functions, Pagination of pages works like it should work: if I trigger the link of previous page in the block of previous page, it surprisingly fires the previous page link. And the same happens for the next page link. And we're in the first page and there is only next-pages (because we are in the newest one), it shows the previous block only. Good.

But when we are in permalink pages and we are in the most newest post, and there should be only the NextPost block... Guess what. Yeah! The only block showing is the PreviousPost block. Tadah! ¬___¬ So I have to implement this last 2 functions for goToPrev and goToNext with the part about permalink pagination CHANGED their logical order (this functions are fired by hotkeys: when the user pushes → goToNext is fired and when he pushes ← goToPrev is fired).

I revised the code again and again and again and AGAIN, and it makes me crazy, till I got this. Anyone can explain me this nonsense?

soulchainer

unread,
Jul 12, 2014, 8:07:38 AM7/12/14
to tumblr...@googlegroups.com
For quick clarification. Is like, in permalink pages: previous post → older post; next post → newer post. Just the opposite than documentation says and the index pagination behavior.
Reply all
Reply to author
Forward
0 new messages