穴位找准 發表於 2023-8-21 00:00:00

wordpress自定义循环列表的php代码

<p>
代码如下:</p>
<p>
<br>
&lt;?php $epaged = (get_query_var('paged')) ? get_query_var('paged') : 1; <br>
$temp = $wp_query; <br>
$wp_query = null; <br>
?&gt; <br>
&lt;?php $wp_query = new WP_Query('category_name=portfolio&amp;tag=web&amp;showposts=5&amp;paged=' . $epaged);?&gt; <br>
&lt;?php if ($wp_query-&gt;have_posts()) : ?&gt; <br>
&lt;section&gt; <br>
&lt;?php while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt; <br>
&lt;article&gt; <br>
&lt;time datetime="&lt;?php the_time('Y-m-d') ?&gt;" pubdate&gt;&lt;?php the_time('F jS, Y') ?&gt;&lt;/time&gt; <br>
&lt;h1&gt; <br>
&lt;a rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;"&gt; <br>
&lt;?php the_title(); ?&gt; <br>
&lt;/a&gt; <br>
&lt;/h1&gt; <br>
&lt;section&gt; <br>
&lt;?php the_content(); ?&gt; <br>
&lt;/secion&gt; <br>
&lt;/article&gt; <br>
&lt;?php endwhile;?&gt; <br>
&lt;div&gt; <br>
&lt;?php <br>
next_posts_link( __( '&amp;larr; Older posts', 'twentyten' ) ); <br>
previous_posts_link( __( 'Newer posts &amp;rarr;', 'twentyten' ) ); <br>
$wp_query = null; $wp_query = $temp; <br>
?&gt; <br>
&lt;/div&gt; <br>
&lt;/section&gt; <br>
&lt;?php <br>
endif; <br>
?&gt; </p>
頁: [1]
查看完整版本: wordpress自定义循环列表的php代码