【发布时间】:2016-09-30 19:47:28
【问题描述】:
希望我的描述会很清楚!
我基本上是在尝试创建一个展示作品集的区域。我在 Wordpress 中创建了一个自定义帖子类型,我想把它带到 front-page.php 中。我已经指定了我希望展示作品的区域 (see image)。 深灰色区域是我只想放置投资组合项目的地方。每个灰色区域应显示 1 个投资组合项目
我正在使用这个脚本来拉入自定义帖子类型:
<?php
$args = array( 'post_type' => 'Portfolio', 'posts_per_page' => 4 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="home-recent-thumb">'; the_post_thumbnail(); echo '</div>';
echo '<div class="home-recent-title">'; the_title(); echo '</div>';
echo '<div class="home-recent-copy">'; the_excerpt(); echo '</div>';
endwhile;
?>
如何在 php 中指定区域,以便在正确的元素内显示 4 个帖子?
【问题讨论】:
标签: php jquery custom-post-type