wordpress自定义循环列表的php代码
wordpress自定义循环列表的php代码
发布时间:2016-12-23 来源:查字典编辑
摘要:

<?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( __( '&larr; Older posts', 'twentyten' ) );

previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) );

$wp_query = null; $wp_query = $temp;

?>

</div>

</section>

<?php

endif;

?>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新WordPress学习
热门WordPress学习
CMS教程子分类