Home › Forums › General Issues › Taxonomy Issue › Reply To: Taxonomy Issue
I think I spoke to soon.. Its 99% there.. I seem to have an issue now which is rather frustrating… I’m getting them to display correctly.. but now when I look in different categories (I have set up 2 different categories), i’m getting both the child categories display… even though they are from different parent categories..
http://whyttip.eu/index.php/meps/bulgaria/
http://whyttip.eu/index.php/meps/belgium/
password: ecr_group
for some strange reason they are both displaying even though one sub category (Bulgaria Without Censorship (България без цензура)) is for Bugaria and the other (New Flemish Alliance (Nieuw-Vlaamse Alliantie)) is for Belgium.
The code i’m using is below. Can anyone help me work this out?
<div class="blog-default">
<div class="master_container container">
<section class="page_content col-xs-12 col-md-12">
<div class="blog-default-bg">
<h2>YOUR MEPS</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla fringilla, orci ut mattis lacinia, enim risus hendrerit ante, fringilla fringilla turpis diam efficitur lectus. Donec sagittis, quam a pellentesque dictum, odio sapien porta eros, eget cursus nibh orci nec purus. Curabitur blandit tincidunt blandit. Morbi fermentum urna sed lacus condimentum scelerisque. Nunc vitae mauris sit amet lectus euismod accumsan.</p>
<form id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get">
<input class="inlineSearch" type="text" name="s" placeholder="Search" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" />
<input type="hidden" name="post_type" value="mep" />
<?php wp_dropdown_categories( 'show_option_none=Select Country&show_count=1&hierarchical=1&taxonomy=meps_category&depth=1' ); ?>
<?php wp_dropdown_categories( 'show_option_none=Select Group&show_count=1&hierarchical=0&taxonomy=meps_category&depth=1' ); ?>
<input class="inlineSubmit" id="searchsubmit" type="submit" alt="Submit" value="Submit" />
</form>
<br/>
<?php $currentCat = $_GET['cat'];?>
<?php $loop = new WP_Query(array('post_type'=>'mep', 'cat'=>$currentCat, 'order' => 'asc')); ?>
<strong><?php echo single_cat_title();?> - Groups and MEPs:</strong>
<div class="clear"></div>
<br/>
<div id="accordion" class="panel-group">
<div class="panel panel-default">
<!-- SUB CATEGORY TITLE AREA -->
<?php
$member_group_terms = get_terms( 'meps_category', array(
'child_of' => $currentCat,
'hierarchical' => false
) );
?>
<?php
foreach ( $member_group_terms as $member_group_term ) {
$member_group_query = new WP_Query( array(
'post_type' => 'mep',
'tax_query' => array(
array(
'taxonomy' => 'meps_category',
'field' => 'slug',
'terms' => array( $member_group_term->slug ),
'operator' => 'IN'
)
)
)
);?>
<div class="panel-heading">
<!--<div class="col-md-2"><img src="#" /></div>-->
<div class="col-md-12"><h3><?php echo $member_group_term->name; ?></h3>
<p><?php echo $member_group_term->description; ?></p></div>
<div class="clear bottomgap"></div>
<div class="col-md-8"></div><div class="col-md-4"><a data-toggle="collapse" data-parent="#accordion" class="button" href="#<?php echo $member_group_term->term_id; ?>">View MEPs</a> <a href="<?php echo $member_group_term->mep_party_link; ?>" class="button" target="_blank">Visit Website</a></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<!-- END SUB CATEGORY TITLE AREA -->
<div id="<?php echo $member_group_term->term_id; ?>" class="panel-collapse collapse col-md-12">
<!-- SUB CATEGORY POSTS AREA -->
<?php if ( $member_group_query->have_posts() ) : ?>
<?php while ( $member_group_query->have_posts() ) : $member_group_query->the_post(); ?>
<div class="panel-body">
<div class="col-md-2 meppic"><?php the_post_thumbnail(); ?></div>
<div class="col-md-10"><h3 class="mepname"><?php echo the_title();?></h3>
<strong><?php the_field('title_position'); ?></strong>
<div class="clear"></div>
<?php the_field('location'); ?>
<div class="clear"></div>
<br/>
<?php the_field('description'); ?>
<div class="clear"></div>
<br/>
<div class="mepdetails"><div class="col-md-3 first"><strong>Email:</strong> <a href="mailto:<?php the_field('email'); ?>"><?php the_field('email'); ?></a></div><div class="col-md-3"><strong>Website:</strong> <a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a></div><div class="col-md-3"><strong>Tel:</strong> <?php the_field('tel'); ?></div><div class="col-md-3 last"><a href="http://www.twitter.com/<?php the_field('twitter_id'); ?>" target="_blank"><?php the_field('twitter_id'); ?></a></div></div>
</div>
</div>
<!-- END SUB CATEGORY POSTS AREA -->
<?php
endwhile;
?>
</div>
<?php endif; ?>
<?php
// Reset things, for good measure
$member_group_query = null;
wp_reset_postdata();
}
?>
</div>
</div>
</div>
</section>
</div>
</div>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.