wordpress function wp_link_pages not working

2019-07-11 15:59发布

The function wp_link_pages() is not working at all in my wordpress template. I have tried all possibilities to make it work. I didn't get any satisfying help for the same online. Please do help me. Guide.

Thanks in advance.

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-11 16:41

Use the plugin WP-PageNavi - sample code below:

<?php get_header(); ?>

 <!-- Start Loop -->
 <?php query_posts('category_name='SomeCategoryName'&orderby=title&order=ASC&paged='. get_query_var('paged')); ?>           

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php //Loop Code Here ?>

    <?php endwhile; else: ?>
        <p class="error">No results found.</p>
    <?php endif; ?> 

   <!-- Start Pagination - WP-PageNavi -->
   <div id="pagination">
            <?php wp_pagenavi(); ?>
   </div>
   <!-- End Pagination -->

<?php wp_reset_query(); ?>
<!-- End Loop -->

<?php get_footer(); ?>
查看更多
可以哭但决不认输i
3楼-- · 2019-07-11 16:42

You should use <!--nextpage--> for work wp_link_pages function.

This tutorial will be help to understand how to work <!--nextpage--> https://www.youtube.com/watch?v=oGFjVx9jDd4

Example: https://codex.wordpress.org/Function_Reference/wp_link_pages#Default_Usage

查看更多
登录 后发表回答