0
我正在建立一個頁面,我想要顯示Bootsrap手風琴中'Recycled Aggregates'類別的帖子。我已經設法在一個新的面板中顯示每個帖子,這很棒,但是現在我需要在這些稱爲「庫存級別」的每個面板上顯示一個自定義分類標準。添加自定義分類到Wordpress後循環?
我已經這麼遠......(它不輸出的值)
任何人都可以擺脫任何光線這是爲什麼不工作?
親切的問候,
肖恩
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<?php foreach(get_the_terms($wp_query->post->ID, ‘stock-levels’) as $term);?>
<?php $catquery = new WP_Query('cat=10&posts_per_page=10'); while($catquery->have_posts()) : $catquery->the_post(); ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<div class="container">
<a data-toggle="collapse" class="collapsed" data-parent="#accordion" href="#collapse<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne">
<h4 class="panel-title">
<?php the_title(); ?><div class="stock-level"><?php echo $term;?></div>
</h4></a>
</div>
</div>
<div id="collapse<?php echo $i; ?>" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-7 col-md-7 col-lg-7 recycled-image">
<?php echo the_post_thumbnail(); ?>
</div>
<div class="col-xs-12 col-sm-5 col-md-5 col-lg-5">
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $i++; endwhile; ?>
</div>
</div>
</div>
</div>
嗨,感謝您的快速回答!問題在於你的建議是每個帖子都會有相同的字詞? – 2015-02-11 11:53:44
結帳的編輯答案 – 2015-02-11 12:05:06
或者你甚至可以用你這樣的查詢 新WP_Query('貓= 10&posts_per_page = 10&分類=‘TAXONOMY_NAME’) – 2015-02-11 12:10:05