下一页按钮将我带到同一页面

I'm trying to have a "previous page" and "next page" links for a particular page (not the main/home page).

When I click on the "next page" link, the page looks the same but the URL says "paged=2".

This code is in the index.php file and works for the main/home page (for next/previous links). But it doesn't work with the page I'm working on, which has a page-template (page-books.php).

In the page-books.php I have the same piece of code:

<div class="nav-home-next">

    <p><?php previous_posts_link('<'); ?>
    <?php next_posts_link('>'); ?></p>

</div>

The full template I'm using that someone else has made (with a few modifications) is here: http://sandbox.onlinephpfunctions.com/code/63eba611a3ffbc1bb564cfd1a3b02f1971dc7a00

In another question from someone else, there was this answer: "You're using paged in the URL, but your code is looking for $_GET['page']

I don't have $_GET['page'] or paged in my code. So I think paged is the default.

I'm not sure as to what to do (I'm still new to coding). How do I get it to work like the main/home page?

Something that could be effecting its output is this code in the functions.php:

function excludeCat($query) {
if ( $query->is_home ) {
$query->set('cat', '-26');
}
return $query;
}
add_filter('pre_get_posts', 'excludeCat');

It removes and posts in the 'books' category from the main page. I don't think it would but I thought it could be useful to know.