Forums

If function exists wp_pagenavi but not used/shown (4 posts)

  1. jonnyplow
    Member
    Posted 1 year ago #

    I use wp_pagenavi and have it wrapped in other styling. I'm basically trying to figure out how not to show that other styling that's included inside my if function_exists statement if wp_pagenavi, or whatever function, is not being USED at that time, even if it does exists. Because if I have a category page that has less posts than the page break amount, it still shows the styling stuff minus the wp_pagenavi.

    <?php if(function_exists('wp_pagenavi')) { ?>
    <div class="somestyledclass">
    <?php wp_pagenavi(); ?>
    </div>
    <?php } ?>

    Any ideas?

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    I use it like this and it works perfectly..... I'm not seeing any issue with yours tho.....

    <?php if(function_exists('wp_pagenavi')) : ?>
                               <div class="pnavi">
    			<?php wp_pagenavi(); ?>
                               </div>
    		<?php else : ?>
    			<div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries')); ?></div>
    			<div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;')); ?></div>
    		<?php endif; ?>
  3. jonnyplow
    Member
    Posted 1 year ago #

    Thank Rev, I see what you're saying. But I'm trying to make <div class="somestyledclass"> simply not show when wp_pagenavi doesn't appear on the page, even when the function still exists.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    Ah, I see what you are saying now...
    http://codex.wordpress.org/Conditional_Tags#A_Paged_Page
    !is_paged() possibly?

Topic Closed

This topic has been closed to new replies.

About this Topic