2016-10-04 2 views
0

범주를 기반으로 "클라이언트"라는 사용자 지정 후 유형의 데이터를 필터링하려고합니다. 내가 필요한 것은 각 특정 고객을위한 로고입니다.ACF + Isotope : 개체 게시 후 데이터 필터링

포스트 오브젝트의 리피터 필드를 설정 했으므로 로고가 표시되는 순서를 변경할 수 있습니다.

현재 작동하지만, 게시 객체 선택기를 통합하는 방법을 알 수 없으므로 Repeater를 통해 추가 한 인스턴스에 따라 결정됩니다.

Here is the link to the site. 감사합니다.

내 대시 보드 설정의 스크린 샷은 아래를 참조하십시오 : 나는 수 있었다

enter image description here

<ul id="filters"> 
        <?php 
         $terms = get_terms("category", array(
          'orderby' => 'slug' 
         )); // get all categories, but you can use any taxonomy 
         $count = count($terms); //How many are they? 
         if ($count > 0){ //If there are more than 0 terms 
          foreach ($terms as $term) { //for each term: 
           echo "<li><a href='#' data-filter='.".$term->slug."'>" . $term->name . "</a></li>\n"; 
           //create a list item with the current term slug for sorting, and name for label 
          } 
         } 
        ?> 
       </ul> 


       <?php $the_query = new WP_Query(array(
        'post_type' => 'clients', 
        'posts_per_page' => '-1', 
        'order' => 'ASC' 
        )); //Check the WP_Query docs to see how you can limit which posts to display ?> 

       <?php if ($the_query->have_posts()) : ?> 
        <div class="isotope-list-container"> 
         <div id="isotope-list" class="row small-up-1 medium-up-2 large-up-3"> 
         <?php while ($the_query->have_posts()) : $the_query->the_post(); 
         $termsArray = get_the_terms($post->ID, "category"); //Get the terms for this particular item 
         $termsString = ""; //initialize the string that will contain the terms 
          foreach ($termsArray as $term) { // for each term 
           $termsString .= $term->slug.' '; //create a string that has all the slugs 
          } 
         ?> 
         <div class="<?php echo $termsString; ?> portfolio columns"> <?php // 'portfolio' is used as an identifier (see Setp 5, line 6) ?> 
          <div class="portfolio-item-container"> 
           <?php 
            $image = get_field('logo'); 
            if(!empty($image)): ?> 
             <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> 
            <?php endif; ?> 
           </div> 
         </div> <!-- end portfolio item --> 
         <?php endwhile; ?> 
         </div> <!-- end isotope-list --> 
        </div> 
       <?php endif; ?> 
       <?php wp_reset_query(); ?> 

답변