Created
July 18, 2017 06:06
-
-
Save designhash/d675abf66edba60044521216ecc6ea41 to your computer and use it in GitHub Desktop.
Display taxonomy list in Homepage with link, description, image via acf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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