/** * Get term meta * * @param int|string $term Can be the id or the slug of the term * @param string $taxonomy * @param string $key * * @author Gijs Jorissen * @since 2.5 */ function the_cuztom_term_meta($term, $taxonomy, $key = null) { if (empty($term) || empty($taxonomy)) { return false; } echo get_cuztom_term_meta($term, $taxonomy, $key); }
/** * Template for Timeline * @author Lionel Mann (Hypenotic) * Dependency: custom-post-timeline.php, filter.scss, footer.php * This template creates a timeline and gets the posts from the * timeline custom post type. */ get_header(); ?> <?php // Get all WP Term data from database by Term field and data. $term = get_queried_object(); // Get all Term data from database from cuztom helper class $cuztom = get_cuztom_term_meta($term->term_id, $term->taxonomy); // Assign cuztom post meta to variables $banner_id = $cuztom['_image']; $banner_url = wp_get_attachment_image_src($banner_id, 'large', true); $headline = $cuztom['_headline']; $icon = $cuztom['_icon']; $color = $cuztom['_color']; ?> <section role="hero" class="center" style="background-image: url(<?php echo $banner_url[0]; ?> );"> <header> <hgroup> <h1 class="reverse--text text__shadow animated fadeInDown"><?php
/** * Used to add the column content to the column head * * @param string $row * @param integer $column * @param integer $term_id * @return mixed * * @author Gijs Jorissen * @since 1.1 * */ function add_column_content($row, $column, $term_id) { $screen = get_current_screen(); if ($screen) { $taxonomy = $screen->taxonomy; $meta = get_cuztom_term_meta($term_id, $taxonomy, $column); foreach ($this->fields as $id_name => $field) { if ($column == $id_name) { if ($field->repeatable && $field->_supports_repeatable) { echo implode($meta, ', '); } else { if ($field instanceof Cuztom_Field_Image) { echo wp_get_attachment_image($meta, array(100, 100)); } else { echo $meta; } } break; } } } }
} } } ?> </div> <h3>Green Sponsors</h3> <div class="green-sponsors sponsor-tier"> <?php $args = array('orderby' => 'date', 'order' => 'ASC'); $terms = wp_get_post_terms(1644, 'sponsors', $args); // print_r($terms); if (!empty($terms) && !is_wp_error($terms)) { foreach ($terms as $term) { $meta_data = get_cuztom_term_meta($term->term_id, $term->taxonomy); $img = $meta_data['_image']; $url = wp_get_attachment_image_src($img, true); $tier = $meta_data['_tier']; $link = $meta_data['_link']; if ($tier == 'value5' && $link !== '') { ?> <a href="<?php echo $link; ?> " target="_blank"><img src="<?php echo $url[0]; ?> "></a> <?php } else {