Skip to content

Instantly share code, notes, and snippets.

@designhash
Created July 18, 2017 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save designhash/d675abf66edba60044521216ecc6ea41 to your computer and use it in GitHub Desktop.
Save designhash/d675abf66edba60044521216ecc6ea41 to your computer and use it in GitHub Desktop.
Display taxonomy list in Homepage with link, description, image via acf
<?php
$taxonomy = 'type';
$terms = get_terms($taxonomy,array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true
)); ?>
<section id="featured">
<div class="container">
<div class="row">
<?php
if ( count($terms) > 0 ){
foreach ( $terms as $term ) {
// Get the term link
$term_link = get_term_link( $term );
?>
<div class="col-12 col-md-6">
<div class="item">
<div class="img">
<a href="<?php echo $term_link; ?>">
<img class="img-fluid" src="<?php echo the_field('featured_image', $term); ?>" alt="">
<h2><?php echo $term->name; ?></h2>
</a>
</div>
<div class="desc">
<p><?php echo $term->description; ?></p>
<div class="text-center"><a href="<?php echo $term_link; ?>">See how it works</a></div>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment