PaginateWP
Archive pagination via the [paginatewp] shortcode for WordPress
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/alexmansfield/paginatewp/archive/refs/heads/main.zipA simple WordPress plugin that outputs archive pagination via the [paginatewp] shortcode. It wraps WordPress's native paginate_links() function, making it available anywhere a shortcode can be placed — particularly useful for page builders like Etch that don't yet include built-in pagination.
Installation
- Upload the
paginatewpfolder to/wp-content/plugins/ - Activate the plugin through the WordPress Plugins menu
Usage
Place the shortcode on any archive template:
[paginatewp]
The shortcode reads the main query ($wp_query) to determine the current page and total pages, then outputs pagination links. It only produces output on paginated archives — on single posts, pages, or archives with one page of results, it silently outputs nothing.
With attributes
All supported attributes mirror the parameters of WordPress's paginate_links() function. Defaults match the WordPress defaults.
[paginatewp mid_size="3" prev_text="Previous" next_text="Next"]
[paginatewp show_all="true" type="list"]
Scroll to a specific element after clicking a page link:
[paginatewp add_fragment="#posts"]
Output
The shortcode wraps its output in a <nav> element:
<nav class="paginatewp" aria-label="Pagination">
<!-- paginate_links() output here -->
</nav>
No CSS is bundled. Style the output using the .paginatewp class and standard WordPress pagination markup (.page-numbers, .current, .prev, .next, .dots).
Supported Parameters
The table below lists every parameter of WordPress's paginate_links() function and whether it is exposed as a shortcode attribute.
| Parameter | Supported | Default | Description |
|---|---|---|---|
show_all |
Yes | false |
Show all pages instead of a short list |
end_size |
Yes | 1 |
Number of page numbers at the start and end of the list |
mid_size |
Yes | 2 |
Number of page numbers on either side of the current page |
prev_next |
Yes | true |
Whether to include Previous and Next links |
prev_text |
Yes | « Previous |
Text for the Previous link |
next_text |
Yes | Next » |
Text for the Next link |
type |
Yes | plain |
Output format: plain, list, or array |
aria_current |
Yes | page |
Value for the aria-current attribute on the current page link |
add_fragment |
Yes | (empty) | URL hash fragment appended to each link (e.g. #posts) |
total |
Auto | (from query) | Total number of pages. Automatically read from $wp_query->max_num_pages. Can be overridden via shortcode attribute. |
current |
Auto | (from query) | Current page number. Automatically read from the paged query var. Can be overridden via shortcode attribute. |
base |
No | — | URL structure for pagination links. Determined automatically by WordPress. |
format |
No | — | Page number URL format. Determined automatically by WordPress. |
add_args |
No | — | Additional query args to append. Requires array input incompatible with shortcode attributes. |
before_page_number |
No | — | Content to prepend inside each page number link. Skipped because shortcode attributes strip HTML. |
after_page_number |
No | — | Content to append inside each page number link. Skipped because shortcode attributes strip HTML. |
Requirements
- WordPress 5.0 or later
- PHP 7.4 or later