Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- taxonomy-{taxonomy}-{term}.php
- taxonomy-maintenance-professional.php
- $args = array(
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'hide_empty' => TRUE,
- 'fields' => 'all',
- );
- $terms = get_terms( 'project_type', $args);
- if (
- ! is_wp_error( $terms )
- && ! empty( $terms )
- ) {
- echo '<ul>';
- foreach ( $terms as $term ) {
- $url = get_term_link( $term );
- if ( is_wp_error( $url ) ) {
- continue;
- }
- $url = add_query_arg( 'post_type', 'projects', $url );
- printf(
- '<li><a href="%s">%s</a></li>',
- $url,
- $term->name
- );
- }
- echo '</ul>';
- }
- $post_type = get_post_type();
- if ( is_post_type_archive() ) {
- $taxonomies = get_object_taxonomies($post_type);
- $related_terms = get_terms(array(
- 'taxonomy' => $taxonomies
- ));
- }
- if ( !empty($related_terms) && !is_wp_error($related_terms) ) {
- foreach ( $related_terms as $related_term ) {
- $term_url = get_term_link($related_term);
- if ( is_post_type_archive() ) {
- $term_url = add_query_arg( 'post_type', $post_type, $term_url );
- }
- ?>
- <a href="<?php echo esc_url($term_url); ?>"><?php echo $related_term->name; ?></a>
- <?php }
- }
Add Comment
Please, Sign In to add comment