function wp_strap_tag_class($taglinks) { $dom = new DOMDocument(); $out = []; if (!empty($taglinks)) { $dom->loadHTML(implode($taglinks)); $tags = $dom->getElementsByTagName('a'); $out = array(); foreach ($tags as $tag) { $link = custom_tag_escape($tag->textContent); array_push($out, ['class' => $tag->getAttribute('class'), 'title' => $tag->textContent, 'link' => $link]); } } return $out; }
</div> </div> </section> <section class="clearfix mb_80"> <div class="container"> <div class="row" id="mixUpElements"> <?php $args = array('post_type' => 'people', 'tax_query' => array(array('taxonomy' => 'role', 'field' => 'slug', 'terms' => get_field('roles')->name))); $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); $tags = get_the_terms($id, 'person-tags'); if (is_array($tags)) { //$values = array_map(function($tag) { return "<a href=\"".$tag->slug."\" rel=\"tag\">$tag->slug</a>"; }, $tags); $values = array_map(function ($tag) { return "<li class=\"filter personTag\" data-filter=\"." . custom_tag_escape($tag->slug) . "\" ><span>" . maxLength($tag->name, 22) . "</span></li>"; }, $tags); $taglist = implode("", $values); $persontags = array_map(function ($tag) { return $tag->slug; }, $tags); } else { //$taglist = "<a href=\"".$tag->slug."\" rel=\"tag\">$tag->slug</a>"; $taglist = "<li class=\"filter personTag\" data-filter=\"." . $tag->slug . "\" >" . maxLength($tag->name, 22) . "</li>"; $persontags = array($tag->slug); } ?> <div class="col-md-4 col-sm-6 col-xs-12 mb_40 mix <?php echo get_initials(get_the_title()) . " "; echo implode(" ", $persontags); ?>
<h2>The Author<?php echo count($posts) > 1 ? "s" : ""; ?> </h2> </div> <?php foreach ($posts as $post) { ?> <?php setup_postdata($post); $tags = get_the_terms($id, 'person-tags'); if (is_array($tags)) { //$values = array_map(function($tag) { return "<a href=\"".$tag->slug."\" rel=\"tag\">$tag->slug</a>"; }, $tags); $values = array_map(function ($tag) { return "<li class=\"filter personTag\" data-filter=\"." . custom_tag_escape($tag->slug) . "\" ><span><a href=\"" . get_site_url() . "/authors/?person-tag=" . $tag->slug . "\">" . maxLength($tag->name, 22) . "</a></span></li>"; }, $tags); $taglist = implode("", $values); $persontags = array_map(function ($tag) { return $tag->slug; }, $tags); } else { //$taglist = "<a href=\"".$tag->slug."\" rel=\"tag\">$tag->slug</a>"; $taglist = "<li class=\"filter personTag\" data-filter=\"." . $tag->slug . "\" ><a href=\"" . get_site_url() . "/authors/?person-tag=" . $tag->slug . "\">" . maxLength($tag->name, 22) . "</a></li>"; $persontags = array($tag->slug); } ?> <div class="col-sm-6 col-xs-12 mb_40 mix <?php echo get_initials(get_the_title()) . " "; echo implode(" ", $persontags); ?>