Function:

mp_core_paginate_links()

Purpose:

This template outputs pagination if needed.

Overview:

This template tag is used to show pagination when needed. To modify the output, use the ‘mp_core_pagination’ filter.

Usage:

This is how to include pagination in a theme with a fallback to paginate_links if the MP Core isn’t installed. This should be used outside of the loop:

function_exists( 'mp_core_paginate_links' ) ? mp_core_paginate_links() : paginate_links();

Parameters:

base
(string) (optional) Used to reference the url, which will be used to create the paginated links. The default value ‘%_%‘ in ‘http://example.com/all_posts.php%_%‘ is replaced by ‘format‘ argument (see below).

Default: ‘%_%’
format
(string) (optional) Used for Pagination structure. The default value is ‘?page=%#%’, If using pretty permalinks this would be ‘/page/%#%’, where the ‘%#%’ is replaced by the page number.

Default: ‘?page=%#%’
total
(integer) (optional) The total amount of pages.

Default: 1
current
(integer) (optional) The current page number.

Default: 0
show_all
(boolean) (optional) If set to True, then it will show all of the pages instead of a short list of the pages near the current page. By default, the ‘show_all‘ is set to false and controlled by the ‘end_size‘ and ‘mid_size‘ arguments.

Default: False
end_size
(integer) (optional) How many numbers on either the start and the end list edges.

Default: 1
mid_size
(integer) (optional) How many numbers to either side of current page, but not including current page.

Default: 2
prev_next
(boolean) (optional) Wheter to include the previous and next links in the list or not.

Default: True
prev_text
(string) (optional) The previous page text. Works only if ‘prev_next‘ argument is set to true.

Default: __(‘« Previous’)
next_text
(string) (optional) The next page text. Works only if ‘prev_next‘ argument is set to true.

Default: __(‘Next »’)
type
(string) (optional) Controls format of the returned value. Possible values are:
  • plain‘ – A string with the links separated by a newline character.
  • array‘ – An array of the paginated link list to offer full control of display.
  • list‘ – Unordered HTML list.
Default: ‘plain’
add_args
(array) (optional) An array of query args to add.

Default: false
add_fragment
(string) (optional) A string to append to each link.

Default: None

Returns:

Void.