Skip to content

Instantly share code, notes, and snippets.

@dfcarpenter
Last active October 1, 2015 21:54
Show Gist options
  • Save dfcarpenter/b67e14ded4726076ff3c to your computer and use it in GitHub Desktop.
Save dfcarpenter/b67e14ded4726076ff3c to your computer and use it in GitHub Desktop.
wordpress
<?php
/*
Template Name: Experiences List
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" role="main">
<div class="experiences">
<ul class="experiences-list">
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 0,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => __( 'Experiences' ),
'show_option_none' => __( '' ),
'number' => null,
'echo' => 1,
'depth' => 0,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'experiences',
'walker' => null
);
$test = get_categories( $args );
?>
<?php
foreach($test as $t) {
$item = get_term($t->term_id, 'experiences');
$link = get_term_link($item,'experiences');
$image = get_field('image', $item);
$color = get_field('color', $item);
?>
<li>
<a style="background-color:<?php echo $color ?>;" href="<?php echo $link ?>">
<img src="<?php echo $image ?>"/>
<h4 class="experience__title"><?php echo $t->name ?></h4>
</a>
</li>
<?php } ?>
</ul>
</div>
</main>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment