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(); ?>