[wordpress插件] Boone's Pagination布恩的分页

wordpress 插件 文章 2020-03-09 07:10 442 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Here’s how I recommend using the class.

这是我推荐使用该课程的方式。

    1. Either activate this plugin, or include the class in your own plugin file.
    2. 要么激活此插件,要么将类包含在您自己的插件文件中。

    3. When you start to render the page with the post list, instantiate the pagination class, using an argument array if you'd like: $pargs = array( 'get_per_page_key' => 'perpage', 'get_paged_key' => '

    4. 当您开始用帖子列表呈现页面时,请根据需要使用参数数组实例化分页类:$ pargs = array('get_per_page_key'=>'perpage','get_paged_key'=>'

      current_page', 'per_page' => 15 );

      current_page','per_page'=> 15);

      $pagination = new BBG_CPT_Pag( $args );

    5. $ pagination = new BBG_CPT_Pag($ args);

    6. When constructing your query arguments (for query_posts() or WP_Query), you can use the class to get your pagination arguments out of the $_GET parameters.

    7. 在构造查询参数(对于query_posts()或WP_Query)时,可以使用该类从$ _GET参数中获取分页参数。

      For instance: $args = array( … ‘posts_per_page’ => $pagination->get_per_page, ‘paged’ => $pagination->get_paged … );

      例如:$ args = array(…'posts_per_page'=> $ pagination-> get_per_page,'paged'=> $ pagination-> get_paged…);

      query_posts( $args );

    8. query_posts($ args);

    9. After firing the query, use the setup_query() method to populate the rest of the class.

    10. 触发查询后,使用 setup_query()方法填充该类的其余部分。

      If you used query_posts(), you don’t need an argument: $pagination->setup_query();

      如果使用 query_posts(),则不需要参数:$ pagination-> setup_query();

      If you use new WP_Query, you’ll have to pass the query object: $my_query = new WP_Query;

      如果您使用 new WP_Query ,则必须传递查询对象:$ my_query = new WP_Query;

      $pagination->setup_query( $my_query );

    11. $ pagination-> setup_query($ my_query);

    12. Then you can use all sorts of fun methods, like $pagination->paginate_links();

    13. 然后,您可以使用各种有趣的方法,例如$ pagination-> paginate_links();。

      $pagination->currently_viewing_text();

    14. $ pagination-> currently_viewing_text();

下载地址
https://downloads.wordpress.org/plugin/boones-pagination.1.1.zip
-EOF-

AI助手支持GPT4.0