I'm trying to figure out how to write a conditional before I call
paginate_links() in my home.php and that will work in other custom page templates.
After reading about pagination in custom loops from How to fix pagination for custom loops? I'm calling my pagination before the reset query.
I've figured out how to get my entered post count in
Settings > Reading > Blog pages show at most with
get_option('posts_per_page') and I've learned how to call total count of posts in a category from Count how many posts in category, based on result display link or not but when I run:
$total_posts = $query->post_count; $per_page_default = get_option('posts_per_page'); if ($total_posts > $per_page_default) : // other code endif;
it works on the first page only but when I go to any page after the first it disappears. Why is that? How can I get pagination to only show when total post count in a particular category in a custom page template and that I can use in home.php work when the posts exceed the set quantity?