Last active
March 14, 2019 13:14
-
-
Save ABooooo/7de38966e3f7dceaa60595b9ffa3c9ac to your computer and use it in GitHub Desktop.
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
$blogcat = get_terms('cl-post-tax'); | |
// Always show link in WP backend on custom post type or posts category | |
(example: https://clevis.sunlime.io/wp-admin/edit-tags.php?taxonomy=cl-post-tax&post_type=cl-post) | |
... | |
if($the_query->have_posts()) : | |
echo '<div class="category-filter">'; | |
$blogcats = get_terms('cl-post-tax'); | |
echo '<ul>'; | |
foreach ( $blogcats as $blogcat ) { | |
// The $term is an object, so we don't need to specify the $taxonomy. | |
$cat_link = get_term_link( $blogcat ); | |
// If there was an error, continue to the next term. | |
if ( is_wp_error( $cat_link ) ) { | |
continue; | |
} | |
// We successfully got a link. Print it out. | |
echo '<li><a href="' . esc_url( $cat_link ) . '">' . $blogcat->name . '</a></li>'; | |
} | |
echo '</ul>'; | |
echo '</div>'; | |
while($the_query->have_posts()) : $the_query->the_post(); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment