我在 wordpress 中创建自定义帖子类型以创建投资组合,然后在主页中我希望此脚本显示我的最后四个客户
<!-- INIZIO LOOP PER L'ESTRAZIONE E RICHIAMO DATI PORTFOLIO-->
<?php
//Array di configurazione Loop
$args = array(
'post_type' => 'portfolio',
'post_per_page' => 4
);
$nuovo_loop = new WP_Query( $args );
if( $nuovo_loop->have_posts() ) :
while( $nuovo_loop->have_posts() ) : $nuovo_loop->the_post();
?>
<!-- Cosa fare dentro il loop -->
<div class="grid_3 portElements">
<div class="full_overlay">
<div class="content">
<span class="portfolioimage">
<p><?php the_title(); ?></p>
<a href="<?php the_permalink(); ?>" target="_self">
<span class="DWSdetails">dettagli</span>
</a>
<a href="<?php
$myExcerpt = get_the_excerpt();
$tags = array("<p>", "</p>");
$myExcerpt = str_replace($tags, "", $myExcerpt);
echo $myExcerpt;
?>" id="outLink" target="_blank">
<span class="view">visita </span>
</a>
</span>
</div>
<div class="portImage" >
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('thumbImage');
}else{
echo '<img src="http://www.dywes.com/wp-content/themes/dywes/images/workinprogress.png" />';
}
?>
</div>
</div>
</div>
<?php
endwhile;
else:
?>
<!-- Cosa fare se il loop non trova niente -->
<?php
endif;
wp_reset_postdata();
?>
</div>
<!--FINE LOOP PORTFOLIO-->
但是当我重新加载页面时,我看到了我所有的客户......我怎样才能看到其中的 4 个?