Skip to content

Instantly share code, notes, and snippets.

@fahdi
Last active August 29, 2015 14:05
Show Gist options
  • Save fahdi/ee1b8cefef1dc6159f11 to your computer and use it in GitHub Desktop.
Save fahdi/ee1b8cefef1dc6159f11 to your computer and use it in GitHub Desktop.
<?php
$terms = get_terms('focus15', array(
'exclude' => array(16, 20, 22, 25, 27, 28, 30, 4, 33 ), //* Enter ID's of parent categories to exclude from list
'hide_empty' => 0 ) );
if($terms)
{
echo '<ul>';
foreach($terms as $term)
{
if( get_field('group_active_in_focus_15', 'focus15_'.$term->term_id) != 'active15' )
continue;
echo '<li>' . list_term_info($lc). '</a></li>';
}
echo '</ul>';
}
?>
<?php
function list_term_info($lc) {
?>
<div class="col-lg-3">
<?php
$termlink = get_term_link($lc->slug, 'focus15'); ?>
<div class="panel panel-default">
<div class="panel-image">
<div class="thumbnail">
<div class="caption">
<br/><br/>
<h1><span class="label label-info"><?php
echo $lc->count
?></span></h1>
<p> Symbols </p>
<h4> <a class="label label-default" href="<?php
echo $termlink; ?>"> View Group</a> </h4>
</div>
<!-- Get Image by Attachment ID Start-->
<?php
$attachment_id = get_field('taximage', 'focus15_' . $lc->term_id);
if ($attachment_id) {
$image = wp_get_attachment_image_src($attachment_id, 'industrygroup-img');
if ($image) {
?>
<img class="img-responsive" src="<?php
echo $image[0]; ?>" />
<?php
}
} else { ?>
<img class="img-responsive" src="http://www.MYSITE.com/wp-content/uploads/2014/08/RA-logo-300px-groups.jpg" alt="<?php
the_title(); ?>" />
<?php
} ?>
</div>
<!-- Get Image by Attachment ID End-->
</div>
<div class="panel-footer text-center"><a href="<?php
echo $termlink; ?>"><?php
echo $lc->name; ?></a>
</div>
</div>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment