0
내가 일을 다음과 같은 기능을 얻을려고 지난 몇 시간 동안 원을 빙글 빙글 계속되고있다 필터링합니다.사용자 정의 포스트 형식 범주는 워드 프레스
상단에 필터를 나타낼 버튼이 하나씩 있어야합니다. '팀 - 세금'으로 설정된 '데이터 필터'속성이 필요합니다.이 비트가 작동하는 것 같습니다. 이러한 필터 아래
나는 갤러리를 가지고 있으며 각 항목은 클래스 명으로 속해있는 team-tax
표시해야합니다 - 나는 그것이 아무것도 반환하지 않는 고군분투 곳입니다.
많은 도움을 주셔서 감사합니다.
<div class="clearfix">
<button class="filter" data-filter="all">All</button>
<?php $args=array('orderby' => 'name','taxonomy'=>'team-tax');
$filters=get_categories($args);
foreach($filters as $filter){ ?>
<button class="filter" data-filter="<?php echo $filter->gallery_nicename; ?>"><?php echo $filter->name; ?></button>
<?php } ?>
<?php
$args = array(
'posts_per_page' => -1,
'post_type' => 'team',
'orderby' => 'menu_order',
'order' => 'ASC',
'taxonomy' => 'team-tax'
);
$query = new WP_Query($args);?>
<button class="sort" data-sort="my-order:asc">Ascending Order</button>
<button class="sort" data-sort="my-order:desc">Descending Order</button>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="gallery gallery-border gallery-mixitup">
<div class="gallery-item mix <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>" data-my-order="1">
<a href="<?php echo get_permalink($post->ID); ?>">
<img src="<?php bloginfo('template_directory'); ?>/dist/images/slider/yachts.jpg">
<div class="overlay"></div>
<div class="gallery-item-text">Lorem Ipsum Dolor</div>
</a>
</div>
</div>
<?php endwhile; else: ?>
<p>There is nothing to see here</p>
<?php endif; ?>
</div>