wordpress自定义循环列表的php代码
代码如下:
<?php $epaged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$temp = $wp_query;
$wp_query = null;
?>
<?php $wp_query = new WP_Query('category_name=portfolio&tag=web&showposts=5&paged=' . $epaged);?>
<?php if ($wp_query->have_posts()) : ?>
<section>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<article>
<time datetime="<?php the_time('Y-m-d') ?>" pubdate><?php the_time('F jS, Y') ?></time>
<h1>
<a rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</h1>
<section>
<?php the_content(); ?>
</secion>
</article>
<?php endwhile;?>
<div>
<?php
next_posts_link( __( '← Older posts', 'twentyten' ) );
previous_posts_link( __( 'Newer posts →', 'twentyten' ) );
$wp_query = null; $wp_query = $temp;
?>
</div>
</section>
<?php
endif;
?>
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/wordpress/7562.html