Coding Tutorial – Part 8: Pagination and Infinite Scroll
This is the last part of this section of tutorials. In this part we are going to finish up the theme by adding in pagination, then looking into infinite scroll.
You are watching: Next page button tumblr
{block:PreviousPage}{lang:Previous page} {/block:PreviousPage}{block:NextPage} {lang:Next page}{/block:NextPage}The above code is the standard for going back and forward between pages. “block:PreviousPage” means that if you’re on the first page, this won’t show, and “block:NextPage” means that if you’re on the very last page, this won’t show.
jonathanlewisforcongress.com has a whole selection of tags beginning with “lang:” which mean that the language will change based on the language settings of the person viewing the page. You can find the full list here.
You can also do other things like write the page number next to the total number of pages, eg: “Page 5 of 34”.
{block:Pagination}{lang:Page CurrentPage of TotalPages}{/block:Pagination}Perhaps you want something that looks more like this:

{block:Pagination}
{block:PreviousPage} Previous {/block:PreviousPage} {block:JumpPagination length=”5″} {block:CurrentPage} {PageNumber} {/block:CurrentPage} {block:JumpPage} {PageNumber} {/block:JumpPage} {/block:JumpPagination} {block:NextPage} Next {/block:NextPage}
{/block:Pagination}For the theme we have been creating, I am going to use «these» arrows to navigate by rather than page numbers, since they are discrete. Also I’ll putting it at the bottom of the sidebar.
{block:PreviousPage}« {/block:PreviousPage}{block:NextPage} »{/block:NextPage}
And I am going to apply a little bit of styling, including setting the links to the right colour since the arrows are not covered by the rules we set out for the main content.
#sidebar .pagination { width: 260px; text-align: center; padding: 3px 0;}#sidebar .pagination a { color: {color:Primary Colour}; text-decoration: none;}#sidebar .pagination a:hover { color: {color:Secondary Colour};}I’m pretty sure I don’t have to say again what this means. I’ll only point out that I set the width to 260px because that’s the width of the sidebar, and it’ll ensure that the arrows are properly centred.
Click herefor a live preview of the theme with the pagination added.
See more: Loves Login The Wave Loves Employee Login, Loves Wave Employee Portal
Infinite Scroll
To begin with we are going to set up the option to turn infinite scroll on and off with a tickbox. If you remember, this is an “if” function in the meta tags.
First of all we need to make sure that the forward and back page arrows don’t appear while infinite scroll is set to on by wrapping it in a “block:IfNot…” tag.
{block:IfNotInfiniteScroll}
…
{/block:IfNotInfiniteScroll}Next, there is a little piece of Javascript which was created by Cody Sherman. All you have to do is copy a single line between the head tags in your blog, and outside of any style tags. I have also wrapped it in “block:IfInfiniteScroll” tags to work with this theme.
{block:IfInfiniteScroll}{/block:IfInfiniteScroll}This usually works alone. However sometimes it is necessary (if the code above doesn’t work by itself) to add an extra div called “autopagerize_page_element” into your html, like so:
{block:Posts}
…
{/block:Posts}
When the tickbox is unchecked, the javascript will do nothing and in turn the extra div should have no affect on your page. However, if you find that it adds a strange margin at the top of the page, which it may, then just call upon “.autopagerize_page_element” in your css and add in a margin of 0.
This section of tutorials is just about done. There is just one more thing that you should add, and that is a little tag called “CustomCSS”. This will insert any code that the user has written in the Custom CSS box on the customise page. It needs to be included inside a style tag, like so:
…
See more: South Park Fractured But Whole Time Fart Pause, How Do I Timefart Pause