【发布时间】:2016-03-27 06:37:19
【问题描述】:
您好,我目前正在做这个项目
我想为前 2 个帖子创建 2 个样式的帖子,为最后 4 个帖子创建另一个样式。
这是我正在使用的代码。
<?php
$args = array( 'posts_per_page' => 2, 'category' => 5 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
// content of the first 2 post here //
<?php endforeach; wp_reset_postdata();?>
<?php
$args = array( 'posts_per_page' => 4, 'category' => 5,'offset' => 2 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
// content of the last 4 post here //
<?php endforeach; wp_reset_postdata();?>
我搜索了,我知道通过这种方式页面分页将不起作用。 但是我只知道一些基本的wordpress和php编码。
谁能帮我解决这个问题?
这是我在PSD做的设计
【问题讨论】:
标签: php wordpress pagination