Adding An Image To A Custom Taxonomy Term
Maybe How TO custom taxonomies extra fields is whats you are looking for?
Maybe How TO custom taxonomies extra fields is whats you are looking for?
hope it isn’t considered overly self-promotional, but i’ve turned stephen harris’ code into a plugin that will do this for you: http://wordpress.org/extend/plugins/radio-buttons-for-taxonomies/ i’m still working on getting the quick edit to show radio buttons too, but that appears to be significantly harder.
Update Indeed, there is a way to define one term per taxonomy as default term which makes it non-deletable from the admin GUI. WP_Terms_List_Table looks for an option get_option( ‘default_’ . $this->screen->taxonomy ). So if you have a custom Taxonomy called genre, you have to set an option default_genre with the term-id of the term … Read more
You’re looking for the meta_box_cb argument. $args = array( ‘hierarchical’ => true, ‘labels’ => $labels, ‘show_ui’ => false, ‘show_admin_column’ => false, ‘show_in_menu’ => true, ‘show_in_nav_menus’ => true, ‘query_var’ => true, ‘rewrite’ => array( ‘slug’ => ‘wheel’ ), ‘meta_box_cb’ => false, ); register_taxonomy( ‘wheel’, array( ‘product’ ), $args ); You can also define a custom callback … Read more
The pre_get_posts filter is immediately before the loop begins in taxonomy-services.php That is too late. The main query runs long before your template loads. Move your pre_get_posts filter to your theme’s functions.php, or a plugin or MU-Plugin file, and you should see the difference.
This is probably happening because the taxonomy you’re trying to query is registered yet. Eg. The WordPress environment is loaded when a theme’s functions.php file loads, but many plugins/themes/core functions don’t register taxonomies until later. Try hooking into init with a really high priority number and running the get_term_by function. Like so: <?php add_action( ‘init’, … Read more
As this is one of the top results on Google and none of the above quite worked for me, this did seem to return terms in an order matching their display in the admin… get_terms([ ‘taxonomy’ => ‘whatever_you_want’, ‘meta_key’ => ‘order’, ‘orderby’ => ‘meta_value_num’ ]); In case it helps anyone, WP stores a value in … Read more
If you are trying to use all of the terms in that taxonomy for something, try this: get_terms( “location”, array( “hide_empty” => 0 ) ); You may be trying to return taxonomy terms that have no relationship to any object.
What you want is an index page for custom taxonomies. There is a ticket for that, but it’s not clear what is the most obvious thing to show on this page: 1) a list of all posts attached to any term of that taxonomy, or 2) a list of all terms of this taxonomy? Remember … Read more
I found a snippet of code courtesy of mfields that solved this problem for me, here’s what I ended up using: <?php // Add custom taxonomies to the post class add_filter( ‘post_class’, ‘custom_taxonomy_post_class’, 10, 3 ); if( !function_exists( ‘custom_taxonomy_post_class’ ) ) { function custom_taxonomy_post_class( $classes, $class, $ID ) { $taxonomy = ‘listing-category’; $terms = get_the_terms( … Read more