繁体   English   中英

为什么我的wordpress主题中的分页没有显示(wp-paginate插件)

[英]why pagination in my wordpress theme is not showing (wp-paginate plugin)

我在wordpress中使用了重新思考主题,并使用了wp-paginate插件

在arcive.php,category.php和index.php分页中很好,但是为什么在page.php中不运行?

我创建了自己的模板,显示所有帖子posting.php

 <?php /* Template Name: posting */ get_header(); ?> <div class="full-content"> <div class="grid_17 alpha"> <div class="content_bar"> <div class="feature_content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $count_posts = wp_count_posts(); $published_posts = $count_posts->publish; $myposts = get_posts(array('posts_per_page'=>3)); ; foreach($myposts as $post) : setup_postdata($post); ?> <div id="post-<?php the_ID(); ?>" <?php post_class('product'); ?>> <div class="post-info"> <h1 class="product_title"> <a href= "<?php the_permalink(); ?>" rel="bookmark" title="<?php echo sprintf(__("Permanent link to %s", 'rethink'), get_the_title(get_the_ID())); ?>"> <?php the_title(); ?> </a> </h1> <div class="detail"> <ul class="post_meta"> <li class="admin"><?php printf(__("Posted by %s", 'rethink'), get_the_author_link()); ?></li> <li class="date"><?php printf(__('Posted on %s', 'rethink'), get_the_time('F j, Y')); ?></li> <li class="category"><?php the_category(','); ?></li> <li class="commentt"><?php comments_popup_link(__('No Comments.', 'rethink'), __('1 Comment.', 'rethink'), __('% Comments.', 'rethink')); ?></li> </ul> </div> </div> <div class="post_thumbnail_wrapper"> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('post_thumbnail', array('class' => 'postimg')); ?> </a> <?php } else { echo rethink_main_image(); } ?> </div> <div class="product_content"><?php the_excerpt(); ?><div class="buttons"><a class="btn-2" href="<?php the_permalink() ?>"><span><?php _e('Read Review', 'rethink') ?></span></a></div> </div> </div> <?php endforeach; if(function_exists('wp_paginate')){ wp_paginate(); } wp_reset_postdata(); ?> <div class="clear"></div> <?php endwhile; else: ?> <div class="product"> <p> <?php _e('Sorry, no posts matched your criteria.', 'rethink'); ?> </p> </div> <?php endif; ?> </div> </div> </div> <div class="grid_7 omega"> <!--Start Sidebar--> <?php get_sidebar(); ?> <!--End Sidebar--> </div> </div> <?php get_footer(); ?> 

我想如何显示我的编码分页? 抱歉,如果代码行不整齐,我还是新手

更新此代码:

if(function_exists('wp_paginate')){
   wp_paginate();  
}

此代码:

if(function_exists('wp_paginate')){
   wp_paginate(array('page' => 'page'));  
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM