Adding Navigation to WordPress – lesson 20

To develop navigation, we need to add at least 15 test records and check, to in the admin panel, was specified in the settings. 10 entries per page. Settings -> Reading settings -> Display on blog pages no more 10 records.

If you have more entries than 10, then the user will only see the latest 10 added entries. To enable the user to view all entries, we can add navigation to the site.

First you need to add the pagination function to the archive.php file after the loop().

add function pagination wordpress to archive

Until the pagination is displayed, since the pagination function() we haven't created yet. Now we have to create this function.

To add navigation, add a new folder named functions to your template folder. In the functions folder, add a new file called pagination.php.

Add code to pagination.php file:

Go to the functions.php file and connect the file with the navigation function there as shown in the picture below:

create functions pagination wordpress

Now, when the function is created and called in the archive.php file, on the site we can see the navigation.

wordpress page navigation code - wordpress lessons

Navigation works but doesn't look very nice, to design the navigation, I suggest adding styles to the end of the /wp-content/themes/my_theme_tmp/css/style.css file

After not difficult work, we have excellent navigation.

wordpress page navigation - wordpress lessons

I gave you the basic function for navigation and told you, how to embed it, whoever needs it can modify the function for your template. Good luck learning WordPress, and as always, I fix the files of the current lesson for you.

zip wordpress theme archive

 

In the next lesson we will learn, how to do navigation in single.php file.


Buy WordPress hosting
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

 

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal