Return only the custom sub-term for custom post type, do not echo term-parent

Here’s more of a complete guide based on the $wp_query object: The Taxonomy First you might want to know in which taxonomy you are, what its name is and retrieve all its available data from the object. // Taxonomy name $taxonomy = get_query_var( ‘taxonomy’ ); // Taxonomy object get_taxonomy( $taxonomy ); // Taxonomy name get_taxonomy( … Read more

Display child taxonomy until the last child

Got some ideas for your requirement. Check below code… $parent=get_queried_object()->term_id; $child = get_categories(‘child_of=”.$parent. “&hide_empty=0&echo=0&taxonomy=custom_taxonomy’); if(count($child)>0){ $i=0; foreach ( $child as $row ) { $i++; echo ‘<li><a href=”‘.get_term_link($row,$row->taxonomy).'”>’.$row->name.'</a></li>’; if(count($child)==$i){ $args=array( ‘post_type’ => ‘custom_post’,’order’ => ‘DESC’, ‘posts_per_page’=>1,’tax_query’ => array( array(‘taxonomy’ => ‘custom_taxonomy’,’terms’ =>$row->term_id, ‘field’ => ‘id’ )) ); $second_query = new WP_Query( $args ); if ($second_query->have_posts()) : … Read more

How to get the singular name of a custom taxonomy?

EDIT Since I missunderstood your question at first, here’s the update that should do what you want. $taxonomies = get_object_taxonomies( ‘my_post_type’, ‘object’ ); foreach($taxonomies as $tax){ echo $tax->labels->singular_name; } Basically, you need to specify to the get_object_taxonomies function that you want an object to be returned. In your function, I’m not sure where the $args … Read more

How to get first post in a category of a custom taxonomy

tax_query takes an array of tax query arguments arrays (it takes an array of arrays) but you are using only single array. The correct code is as following. <ul class=”product-categories”> <?php $categories = get_terms( array( ‘produkter’ ), array( ‘hide_empty’ => false, ) ); foreach( $categories AS $cat ) { $taxonomy = new WP_Query( array( ‘posts_per_page’ … Read more

Best pratice to make taxonomy terms translatable without changing slugs?

I’m not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the “original”. However, I recently hade a similar problem where I needed the ability to add a “pluralized” version of … Read more

Modify Term Update Redirection

I agree with you, it’s somewhat an unexpected user experience, when you’re redirected after updating a term. Additionally there seems to be no error handling on the form itself, if you try to make some errors, like deleting the term name and slug, it will not show any errors, just ignore your changes and redirect. … Read more

Widget to display custom taxonomy tag cloud

Don’t know of any but you can easily create your own: <?php add_action(“widgets_init”, array(‘Widget_Custom_tax_tag_cloud’, ‘register’)); class Widget_Custom_tax_tag_cloud { function control(){ echo ‘No control panel’; } function widget($args){ echo $args[‘before_widget’]; echo $args[‘before_title’] . ‘Your widget title’ . $args[‘after_title’]; $cloud_args = array(‘taxonomy’ => ‘Your taxonomy here’); wp_tag_cloud( $cloud_args ); echo $args[‘after_widget’]; } function register(){ register_sidebar_widget(‘Widget name’, array(‘Widget_Custom_tax_tag_cloud’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)