Remove alphabetical order from wordpress categories

Here you go: just place this in your functions.php: /** * Sort post_tags by term_order * * @param array $terms array of objects to be replaced with sorted list * @param integer $id post id * @param string $taxonomy only ‘post_tag’ is changed. * @return array of objects */ function plugin_get_the_ordered_terms ( $terms, $id, $taxonomy … Read more

Show only 1 term of a current posts taxonomy

This is more PHP than WordPress, but wp_get_post_terms returns a numerically indexed array, so all you need is basic PHP array syntax to grab the first item. $terms = wp_get_post_terms($post->ID, ‘custom_cat’); print_r($terms[0]->name); You don’t specify which item you want. This will get you last item: $terms = array_pop($terms); print_r($terms);

How can i retrieve all custom registered taxonomy?

The built-in taxonomies are registered with the parameter _builtin set to TRUE. To get all custom taxonomies, ask for ‘_builtin’ => FALSE: add_action( ‘wp_footer’, function() { $taxonomies = get_taxonomies( array( ‘_builtin’ => FALSE ) ); print ‘<pre>’ . print_r( $taxonomies, 1 ) . ‘</pre>’; });

Display only first level children of my custom taxonomy categories

Try the following code: $taxonomy_name=”listing_category”; $queried_object = get_queried_object(); $term_id = $queried_object->term_id; $termchildren = get_terms( $taxonomy_name, array( ‘parent’ => $term_id, ‘hide_empty’ => false ) ); echo ‘<ul>’; foreach ( $termchildren as $child ) { echo ‘<li><a href=”‘ . get_term_link( $child, $taxonomy_name ) . ‘”>’ . $child->name . ‘</a></li>’; } echo ‘</ul>’;