Articles of get the term list

Add arguments to get_the_terms for custom post types

When using get_the_terms to retrieve terms within a taxonomy for a custom post type you can’t pass arguments, like so: function custom_cat_function() { global $post; $args = array( ‘orderby’ => ‘ID’, ‘order’ => ‘ASC’, ); $terms = get_the_terms($post->id, ‘category’, $args); $count = count( $terms ); if ( $count > 0 ) { foreach ( $terms […]

Print current post category during WP_Query

How do I print the current post category names so that I can output them as ID’s within the HTML, with a space between each category name. I currently have the code: <?php $args = array( ‘post_type’ => ‘work’, ‘posts_per_page’ => ‘9’ ); $work_loop = new WP_Query( $args ); if ( $work_loop->have_posts() ) : while […]

get_term_link is Ending to single.php

I have a template like this: page-movie.php taxonomy-movie.php taxonomy.php and I am using the get_term_link() at page-movie.php to list and link from the indexed page into List of all Custom Post Types under that term in taxonomy-movie.php but this is ending in single.php page when user click on one of the listed terms! <?php $tax […]

Having Issue on Passing Variable into HTML Class Tag

Working in WordPress PHP I am trying to pass a value into class tag of an element <div class=”element-item”></div> to be like <div class=”element-item comedy”></div> $term = get_the_term_list( get_the_ID(), ‘type’ ); echo ‘<div class=”element-item ‘.$term.'”>’; the value is pupping out of the class tag and display on the page! I checked the source code and […]

How to apply comma separation,strip_tags and orderby to wp_get_object_terms

I have this… <?php echo strip_tags (get_the_term_list( $post->ID, ‘school-year-level’, ‘ ‘,’, ‘)); ?> which nicely unlinks and comma separates a list of terms from a specified custom taxonomy (school-year-level). However the list isn’t in the order I want. I’ve hunted down this… http://codex.wordpress.org/Function_Reference/wp_get_object_terms <?php $product_terms = wp_get_object_terms( $post->ID, ‘school-year-level’, $args ); $args = array(‘orderby’ => […]

Separate Custom Post Type Taxonomy by Comma

I tried to figure out how to separate the custom post type taxonomies. $terms = get_the_terms( $post->ID , array( ‘commitments’, ‘type’ ) ); foreach ( $terms as $term ) { $term_link = get_term_link( $term, array( ‘commitments’, ‘type’ ) ); if( is_wp_error( $term_link ) ) continue; echo ‘<a href=”‘ . $term_link . ‘”>’ . $term->name . […]

PHP Code to Display Term URL & Name of a Post Under a Custom Post Type

I am featuring a post in my footer(outside the loop) from a custom post type and am using Advanced Custom Fields plugin to do so. This is the code I am using: <h5>Featured Movie</h5> <?php query_posts(array( ‘posts_per_page’ => 1, ‘post_type’ => ‘movies’, ‘orderby’ => ‘post_date’, ‘meta_key’ => ‘featured_movie’, ‘meta_compare’ => ‘=’, ‘meta_value’ => 1, ‘paged’ […]

get_the_term_list – Return links to edit.php instead of link to taxonomy archive template

I would like to use get_the_term_list or another function if it exists to return links to the posts of the appropriate term (which has been clicked) on edit.php instead of returning links to posts of the clicked term on the taxonomy archive page. Can this be achieved?

Display only child terms of a specific parent term of a custom taxonomy, for each custom post

I have a custom post type named ‘hub’, with a custom taxonomy named ‘5imp’. The ‘5imp’ taxonomy has 5 parent terms, and I would like to display a list of all the post-assigned child terms for only one of those parent terms, named ‘top’, below each custom post.

Allow user to set custom order to a list of custom taxonomies?

I have a custom category checkbox on each individual bio attorney page that shows what practice areas these attorneys are involved in. Currently I have them sorting alphabetically. I am wondering if there is anyway to allow each attorney to set their own custom order when selecting their practice areas. Here is a screenshot of […]