0
저는 처음으로 오랫동안 청취자였습니다.Wordpress 카테고리 페이지 루프가 이미지와 제목을 표시하지 않습니다.
저는 WordPress 테마로 작업 중이며 내 범주 페이지에서 루프 중 하나와 문제가 있습니다. 카테고리 페이지에 2 개의 루프가 있습니다. 문제가있는 첫 번째 루프는 사용자가보고있는 카테고리에서 가장 최근 게시물을 표시하고 2 루프는 나머지 게시물의 그리드를 표시합니다. 두 루프는 첫 번째 루프가 게시물의 제목이나 추천 이미지를 가져 오지 않는 경우를 제외하고는 모두 작동합니다. 코드는 다음과 같습니다.
<?php global $post; $cat_posts = get_posts('numberposts=1&category='.$catID);
foreach($cat_posts as $post) : ?>
<div class="featuredimagec"> <?php global $post; if(has_post_thumbnail()) {
the_post_thumbnail(); }?>
<p> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('large'); ?></a></p> </div><div class="featuredcontenttex">
<?php $postTitle = get_the_title(); if($title != $postTitle) :?>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?>
</a></h1><?php the_excerpt(); ?>
</div>
</div>
<?php endif ;?>
<?php endforeach; ?>
<?php wp_reset_query(); ?>
도움이 되셨습니까? 감사.