Next Page Navigator Plugin

The Next Page Navigator plugin adds shortcodes [nextpage] and [prevpage] to navigate to the next and previous pages of a multi-page post. It also provides additional pagination settings for WordPress.

Features

  • Shortcodes for navigating to the next and previous pages of a multi-page post.
  • Customizable link text and styles.
  • Options to enable, disable, or use default WordPress pagination.
  • Conditional display of pagination links.
  • Supports custom CSS for pagination links.
  • Disable pagination per page.
  • Integration with the WordPress settings page for easy configuration.

Installation

  1. Download the plugin file and unzip it.
  2. Upload the next-page-navigator folder to the /wp-content/plugins/ directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.

Usage

Shortcodes

  • [nextpage]: Displays a link to the next page of a multi-page post.
  • [prevpage]: Displays a link to the previous page of a multi-page post.

Attributes

Both shortcodes accept an optional text attribute to customize the link text.

Example:

phpCopy code[nextpage text="Continue Reading"]

[prevpage text=“Go Back”]

Settings

General Settings

  1. Go to Settings > Next Page Navigator to configure the plugin.
  2. Customize the following settings:
    • Next Link Text: Set the default text for the next page link.
    • Previous Link Text: Set the default text for the previous page link.
    • Post Pagination Option: Choose between enabling the plugin’s pagination, using default WordPress pagination, or disabling pagination.
    • Disable Pagination Per Page: Optionally disable pagination per page.
    • Custom CSS: Modify the default styles of the pagination links.
  3. Click Save Changes to apply your settings.

Meta Box Settings

  1. When editing a post, you’ll find a meta box titled Next Page Navigator Settings in the sidebar.
  2. You can disable pagination for the specific post by checking the Disable Pagination for this Post option, applicable only when the “Post Pagination Option” is set to “Enable” or “Default”.

Customization

Custom CSS

You can customize the appearance of the pagination links by modifying the CSS in the settings page.

Default CSS with Comments:

cssCopy code/* Container for pagination links */
.ib-npn-pagination {
    display: flex; 
    justify-content: space-between; /* Align links to the ends */
}

/* Container for individual next and previous links */
.ib-npn-pagination .ib-npn-next-page, .ib-npn-pagination .ib-npn-prev-page {
    width: fit-content; /* Fit to content width */
}

/* Styling for the next and previous links */
.ib-npn-next-page, .ib-npn-prev-page {
    text-decoration: none; /* Remove underline from links */
    background: #b22222; /* Background color */
    width: 100%; /* Full width */
    display: block; /* Display as block */
    text-align: center; /* Center the text */
    color: #FFF; /* Text color */
    font-size: x-large; /* Font size */
    border-radius: 10px; /* Rounded corners */
    padding: 5px; /* Padding around text */
    font-weight: 600; /* Bold text */
}

/* Hover effect for next and previous links */
.ib-npn-next-page:hover, .ib-npn-prev-page:hover {
    background: #ff4500; /* Background color on hover */
    color: #FFF; /* Text color on hover */
}

To reset to the default CSS, click the Reset to Default CSS button on the settings page.

Developer Notes

Functions

next_page_shortcode($atts)

Generates the next page link.

  • Parameters: $atts (array) – Shortcode attributes.
  • Returns: HTML string for the next page link.

prev_page_shortcode($atts)

Generates the previous page link.

  • Parameters: $atts (array) – Shortcode attributes.
  • Returns: HTML string for the previous page link.

paginate_next_page_css()

Outputs the custom CSS for the pagination links.

  • Hooked to: wp_head.

next_page_navigator_register_settings()

Registers the plugin settings.

  • Hooked to: admin_init.

next_page_navigator_settings_menu()

Adds the settings menu to the WordPress admin.

  • Hooked to: admin_menu.

next_page_navigator_settings_page()

Displays the settings page content.

next_page_navigator_post_meta_box()

Adds the meta box to the post editor.

  • Hooked to: add_meta_boxes.

next_page_navigator_meta_box_callback($post)

Renders the meta box content.

  • Parameters: $post (WP_Post) – The post object.

next_page_navigator_save_post_meta($post_id)

Saves the meta box settings.

  • Parameters: $post_id (int) – The ID of the post being saved.
  • Hooked to: save_post.

next_page_navigator_modify_pagination($content)

Modifies the content to include the custom pagination links.

  • Parameters: $content (string) – The post content.
  • Returns: Modified post content.
  • Hooked to: the_content.

next_page_navigator_disable_default_wp_pagination($link_pages)

Disables the default WordPress pagination if the plugin’s pagination is enabled or pagination is disabled.

  • Parameters: $link_pages (string) – The pagination links.
  • Returns: Empty string if custom pagination is enabled, otherwise the original pagination links.
  • Hooked to: wp_link_pages.

next_page_navigator_action_links($links)

Adds a settings link to the plugin’s action links on the plugins page.

  • Parameters: $links (array) – The plugin action links.
  • Returns: Modified plugin action links.
  • Hooked to: plugin_action_links_<plugin_basename>.

Contact

54122 Dev Drive
New York, NY 10060

+1 000 000 0000
Contact Us

Connect

Subscribe

Join our email list to receive the latest updates.

Add your form here