0
我試圖從基於類別的稱爲「客戶端」的自定義發佈類型過濾數據。我需要顯示的是每個特定客戶的標識。ACF +同位素:過濾器發佈對象數據
我已經設置了發佈對象的中繼器字段,所以我可以更改標識的顯示順序。
我目前的工作,但我無法弄清楚如何合併後對象選擇器,以便出現的是由我通過中繼器添加的實例確定。
Here is the link to the site.欣賞任何答案!
請參閱以下我的儀表盤設置的截圖:
<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(); ?>