In the Avada Theme there is a page template called 'FAQ page', this 'FAQ Page' can have categories (faq_category_1) and in these categories there can be unlimited questions with answers.
This part of the code (below) gets the categories uncluding the questions/answers, all of them.
What I want to achieve is I only want to show the questions/answers from one specific category that is for example equal to the page title ($title) by using an if statement.
<?php $portfolio_category = get_terms('faq_category_1');
if($portfolio_category):
?>
<ul class="faq-tabs clearfix">
<li class="active"><a data-filter="*" href="#"><?php echo __('Alle', 'Avada'); ?></a></li>
<?php foreach($portfolio_category as $portfolio_cat): ?>
<li><a data-filter=".<?php echo urldecode($portfolio_cat->slug); ?>" href="#"><?php echo $portfolio_cat->name; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="portfolio-wrapper">
<div class="accordian fusion-accordian">
<div class="panel-group" id="accordian-one">
<?php
$args = array(
'post_type' => 'avada_faq_1',
'nopaging' => true
);
$gallery = new WP_Query($args);
$count = 0;
while($gallery->have_posts()): $gallery->the_post();
$count++;
?>
<?php
$item_classes = '';
$item_cats = get_the_terms($post->ID, 'faq_category_1');
if($item_cats):
foreach($item_cats as $item_cat) {
$item_classes .= urldecode($item_cat->slug) . ' ';
}
endif;
?>
I am a beginning coder (also my first question here:)) and I am not sure where I exaclty need to adjust the code. Thank you!