0
내 WooCommerce 저장소에서 "카탈로그에서 재고가없는 항목 숨기기"를 사용할 수 있습니다. 이 옵션을 사용하면 개별 페이지의 제품 변형이 보이지 않게됩니다..재고 없음 - shop 페이지의 가시성을위한 "pre_get_post"taxanomy
"카탈로그에서 재고가없는 항목 숨기기"옵션 을 아카이브 페이지 (검색, 범주)에만 적용하려는 경우. 여기
내 코드입니다 :function featured_posts($query) {
if (! $query->is_main_query()) return;
//What goes in here?
}
add_action('pre_get_posts', 'featured_posts');
내가 어떻게 이것을 달성 할 수 있습니까?
function featured_posts($query) {
if(is_product_category() || is_search()){
if (! $query->is_main_query()){
return;
}
}
....
}
add_action('pre_get_posts', 'featured_posts');
안녕을 따를
감사 – Jason