Navigation not working for custom post type pages

I was just navigating through that code and was able to solve it myself. If you look at the 5th line from the start I have called the wp_pagenavi() function which requires a plugin named WP-pagenavi. After installing and setting it up, I got the desired results. Thanks anyways 🙂