无法使分页正常工作。这是我的档案工作。php:
<?php get_header(); ?>
<main role="main">
<!-- section -->
<section>
<h1><?php _e( \'Work\', \'html5blank\' ); ?></h1>
<?php get_template_part(\'loop\', \'work\'); ?>
<?php get_template_part(\'pagination\'); ?>
</section>
<!-- /section -->
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
循环工作。php:
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$work = array(
\'post_type\' => \'work\'
,\'numberposts\' => -1
,\'posts_per_page\' => 2
,\'paged\' => $paged
);
$loop = new WP_Query( $work );
if ($loop->have_posts()): while ($loop->have_posts()) : $loop->the_post(); ?>
<!-- article -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- post thumbnail -->
<?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
<div class="thumbnail">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail(array(300,225)); // Declare pixel size you need inside the array ?>
</a>
</div>
<?php endif; ?>
<!-- /post thumbnail -->
<header>
<!-- post title -->
<h2 class="title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
<!-- /post title -->
<span class="date"><?php the_time(\'F Y\'); ?></span>
</header>
<br/><br/>
<!-- post details -->
<!--span class="author"><?php _e( \'Published by\', \'html5blank\' ); ?> <?php the_author_posts_link(); ?></span-->
<!--span class="comments"><?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( \'Leave your thoughts\', \'html5blank\' ), __( \'1 Comment\', \'html5blank\' ), __( \'% Comments\', \'html5blank\' )); ?></span-->
<!-- /post details -->
<?php html5wp_excerpt(\'html5wp_index\'); // Build your custom callback length in functions.php ?>
<?php edit_post_link(); ?>
</article>
<!-- /article -->
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h2><?php _e( \'Sorry, nothing to display.\', \'html5blank\' ); ?></h2>
</article>
<!-- /article -->
<?php endif; ?>
如果我将默认页面设置为2,它会显示第3个和第4个条目。。。那么为什么链接不显示呢?这就是如何在主题的默认存档/循环中进行设置的。
供您参考:https://github.com/toddmotto/html5blank
谢谢