Creating a navigation link plugin for WordPress

Creating a navigation link plugin for WordPress
In the article we will write a simple plugin for WordPress, which displays links to the “Next” and “Previous” page on the sides of the screen, with the display of page names when you hover the mouse cursor over them.

For this task, you can not write an additional plugin, since all the functions that display the “Next” and “Previous” links are already in WordPress, and here they are, respectively:

But for the beauty of the code, the plugin solution is a winning one. To begin with, let’s call the plugin: wp-nav-side-links – the name of the plugin should be unique. Create a wp-nav-side-links folder in the wordpress plugins folder and create a wp-nav-side-links.php file. This file will contain the main code. You’ll also need a wpnavsidelinks.css style file, a wpnavsidelinks javascript file.js, and an images folder to store the images to the styles.

The title of the plugin, denoted as follows:

The plugin code itself with the functions of registering styles, scripting and defining next_post_link() and previous_post_link() functions is as follows:

To install pointers to the record page, it will be enough to register in single.php the wpnavsidelinks_shortcodenew() function, which will display two links on the sides of the page at once.

To set the pointers to the middle of the height of the screen, use the following javascript code:

It remains to set the styles. The result of the plugin is as follows:

Creating a navigation link plugin for WordPress

All files with the plugin are packed into an archive, which you can download here:


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a comment

Your email address will not be published.