Created
June 18, 2019 18:11
-
-
Save taciara/bad3a77c3f06f38d2bdbcec59ad4b955 to your computer and use it in GitHub Desktop.
Loop da taxonomia dentro de um post type
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 //COLE ISSO EM LOOP DO POST TYPE ?> | |
| <?php $getCats = get_terms("NOMEDATAXONOMIA", array("hide_empty" => false)); ?> | |
| <?php foreach($getCats as $getCat): ?> | |
| <?php // USE ESSE TRECHO APENAS SE A SUA TAXONOMIA CONTER CAMPO PARSONALIZADO | |
| $id_Imagem = get_term_meta($getCat->term_id, 'NOMEDOCAMPOPERSONALIZADO', true); | |
| $minhaImagem = wp_get_attachment_image_src($id_Imagem,'full'); | |
| ?> | |
| <div class="item"> | |
| <a href="<?php echo get_term_link($getCat->term_id); ?>"> | |
| <figure> | |
| <i <?php if($minhaImagem): ?> style="background-image: url(<?php echo $minhaImagem[0]; ?>);" <?php endif;?> ></i> | |
| </figure> | |
| <h3><?php echo $getCat->name; ?></h3> | |
| </a> | |
| </div> | |
| <?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment