누구든지이 코드를 편집하도록 도와 줄 수 있습니까? 2 개의 카테고리가 있는데, 클릭하면이 카테고리의 모든 게시물이 표시됩니다. 이제 카테고리 ID 8의 두 카테고리 콘텐츠가 표시됩니다. category.php의 내 코드
<?php
$args = array( 'posts_per_page' => 5, 'category' => 8);
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<li class="ikonakategoriiwpisu">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_post_thumbnail( 'thumbnail' ); ?> </a><?php the_excerpt(); ?>
</li>
<?php endforeach;
wp_reset_postdata();?>
페이지 URL에 카테고리가 있으면 다음과 같이 사용할 수 있습니다.
$category_id = get_query_var('cat');
$args = array( 'posts_per_page' => 5, 'category' =>$category_id );
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다