Paginate Your WordPress Site Without Plugins. Good pagination is very useful for allowing users to browse through your website. Rather than “previous” or “next” links.

This is where another one of our code snippets for WordPress comes into play – it adds good pagination to your content. WordPress had a built-in function called paginate_links(), which can be used to paginate your blog without using any plugins.

In your themes, functions.php place the code below:

global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 )  {
     // get the current page
     if ( !$current_page = get_query_var('paged') )
          $current_page = 1;
     // structure of "format" depends on whether we're using pretty permalinks
     $format = empty( get_option('permalink_structure') ) ? '&page=%#%' : 'page/%#%/';
     echo paginate_links(array(
          'base' => get_pagenum_link(1) . '%_%',
          'format' => $format,
          'current' => $current_page,
          'total' => $total,
          'mid_size' => 4,
          'type' => 'list'
     ));
}


Related Videos:

 


Related Posts:

Should I Choose a Hosted or Non-hosted Blogging Platform?

Introduction to Python Programming Language

How To Start a Blog – Beginner’s Guide for 2020

Learn Python Lists

Change the Author Permalink Structure

Google admits it forgot to tell users about its hidden spy microphone

How to Update: Automatically create media_buttons for shortcode selection

Disable the Admin Bar in WordPress

Coordinate Links and Content for Success

What’s behind this 1,000-character phishing URL?

Google is about to have a lot more ads on phones

Avada Theme Version 5.5.2

Kodi-04-2019 No Limits Wizard Magic Build for Kodi 18 Leia

Increase User Engagement & Why It Matters for SEO

Fake Google reCAPTCHA used to hide Android banking malware

What is the use of New Keyword in VB.NET?

Show Post Thumbnails in RSS Feed – WordPress

WordPress, SEO, and Social Media Marketing

How to make a Go-Back Input button with inline JavaScript

How do I install plugins in WordPress?

How do I create money online using WordPress?

Choose your preferred blog CMS platform

WordPress by the Numbers Facts

How do I start a WordPress blog? (hosting wordpress)

Redirect New Registered Users to a Specific Page – WordPress

What is a Blog?

WordPress Posts vs Pages

Show Popular Posts Without Plugins