Hello guys,
I have a problem in some subcategories , using Custom Fields:
I have an Accordion with 3 areas , each area has a sublevel that is the specialty , and specialty contains links to videos.
I need to click on the area the accordion open specialties and specialties to list all posts with the same Custom Field .
What is happening is that for each different link it recreates the specialty , ie if you have 10 links with the Specialty Thorax it shows 10 sub-levels and not just a sublevel ‘ Thorax ‘ with 10 links .
Follows the code , and I hope someone can help me:
`
<!– section –>
<?
$post_type = ‘videos’;
$tax = ‘videos-categories’;
$tax_terms = get_terms($tax);
if ($tax_terms) {
foreach ($tax_terms as $tax_term)
{
$args=array(
‘post_type’ => $post_type,
“$tax” => $tax_term->slug,
‘post_status’ => ‘publish’,
‘order’ => ‘ASC’,
‘posts_per_page’ => -1,
‘caller_get_posts’=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo ‘<h2 class=”acc_title_bar”>‘. $tax_term->name .’ ‘.$result.’</h2>’;
echo ‘<div class=”acc_container”>’;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class=”block”>
<h2 class=”acc_title_bar”><?php echo get_field(“subEspecialidade”) ?></h2>
<div class=”acc_container”>
<div class=”block”>
<h3>
.mp4″ rel=”lightbox” data-lightbox-type=”iframe”>
<? echo get_field(“codVideo”); ?> – <? the_title(); ?>
</h3>
</div>
</div>
</div>
<?php
endwhile;
echo ‘</div>’;
}
wp_reset_query();
}
}
?>’