T
T
Toster7772018-04-29 21:19:18
WordPress
Toster777, 2018-04-29 21:19:18

How to hide pagination in Wordpress?

I have the WP-PageNavi plugin. I'm posting with my edits:

<div class="wp-pagenavi-block">
<div class="wp-pagenavi-title"><span>Навигация по страницам</span></div>
<div class="next-page"><?php next_posts_link('Следующая страница »') ?></div>
<?php wp_pagenavi();  ?>
</div>

But the navigation block appears on pages where it is not needed. I mean not the pagination itself, but the block without content (Only with wp-pagenavi-title) (decorated in CSS)
What condition should I set to hide this piece of code if there really is no pagination?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-04-29
@azerphoenix

Hello!
Should help - https://wp-kama.ru/function/is_paged

<?php if( !is_paged() ){ ?>
<div class="wp-pagenavi-block">
<div class="wp-pagenavi-title"><span>Навигация по страницам</span></div>
<div class="next-page"><?php next_posts_link('Следующая страница »') ?></div>
<?php wp_pagenavi();  ?>
</div>
<?php } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question