![](/img/trans.png)
[英]Pagination for custom post type on custom page template in Wordpress
[英]Display Post image on the Custom Page Template with Pagination
我有我的頁面模板的代碼。
這就是我現在所擁有的: http : //www.ohright.com/emoticons/
如何更改它以便它可以以每頁20張圖像和下面的分頁顯示我的所有帖子圖像?
<?php
/*
Template Name: emoticons-page
*/
get_header(); ?>
<div id="content">
<div id="main">
<?php query_posts('cat=44'.get_the_title().'&post_status=publish,future');?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<p><?php the_content(); ?>
<?php endwhile; else: endif; ?>
</div>
</div>
<?php get_footer(); ?>
<?php
/*
Template Name: emoticons-page
*/
get_header(); ?>
<div id="content">
<div id="main">
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$posts_per_page = 20;
query_posts('cat=44&post_status=publish&paged=' . $paged . '&posts_per_page=' . $posts_per_page);?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<p><?php the_content(); ?>
<?php endwhile;
posts_nav_link();
wp_reset_query();
endif; ?>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.