I wanted to create a condition in a theme, where if the plugin wp_pagenavi existed then use the plugin. If the plugin does not exist, then use the text Next and Previous.  Researching through the internet took quite some time and without a functioning code.  I found this code in another Wordpress theme and applied it to another and it worked great.  The code below was applied to the footer.php file and any existing remnant of the original code was removed from the index.php page.

<div class="post_nav">
<?php if(function_exists('wp_pagenavi')): ?>
<?php wp_pagenavi(); ?>
<?php else : ?>
<?php posts_nav_link(); ?>
<?php endif; ?></p>
</div>

I also appended the following to the style.css. It wasn't really necessary to get the code operational, but did make things a little smoother.  This code was also taken from a theme or two.

.post_nav {
float: left;
width: 620px;
padding-left: 10px;
}

.post_nav a:link, .post_nav a:visited {
color: #006699;
text-decoration: none;
}

.post_nav a:hover, .post_nav a:active {
color: #006699;
text-decoration: underline;
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading ... Loading ...
      Print This Post       Print This Post       Email This Post       Email This Post

Related Articles1,881 views