我认为这与所问的问题完全不同here.
我正在使用过滤器挂钩向主题添加分页。输出显示在内容的开头和结尾,而不仅仅是结尾。
我的函数,在模板的函数中。php文件:
add_filter(\'the_content\',\'pagination_after_post\',1);
/**
* Adds pagination after the post
*
* @uses is_single()
*/
function pagination_after_post($content){
if( is_single() ){
$content .= \'<div class="pagination">\' . wp_link_pages(\'before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous\') . \'</div>\';
return $content;
} // if
} // pagination_after_post
这是我的单曲。php:
<?php get_header(); ?>
<div id="centercol">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="singleh2"><a title="<?php _e(\'Permanent Link to\',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="date-comments">
<p class="fl"><?php the_time(\'l, M j, Y \\a\\t g:i a\'); ?> by <a href="<?= get_author_posts_url( get_the_author_meta( \'ID\' ) ) ?>" rel="author"><?= get_the_author() ?></a></p>
<p class="fr"><?php the_category(\', \') ?></p>
</div>
<div class="entry">
<?php echo woo_get_embed(\'embed\',\'500\',\'360\',\'video-post\'); ?>
<?php the_content(__(\'<span class="continue">Continue Reading</span>\',woothemes)); ?>
</div>
<?php the_tags(\'<p>Tags: \', \', \', \'</p>\'); ?>
</div><!--/post-->
<div id="comments">
<?php comments_template(); ?>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php previous_post_link(); ?></div>
<div class="alignright"><?php next_post_link(); ?> </div>
</div>
<?php endif; ?>
</div><!--/centercol-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
以及问题的屏幕截图: