Loop through custom taxonomies and display posts

I thought I would provide another answer as the above one is a little hacky, also I added another layer that gets all taxonomies for a post_type. $post_type=”post”; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies( (object) array( ‘post_type’ => $post_type ) ); foreach( $taxonomies as $taxonomy ) : // Gets … Read more

Custom columns on edit-tags.php main page

You can do this by hooking into the ‘taxonomy’_edit_form and edited_’taxonomy’ actions. add_action(‘taxonomy_edit_form’, ‘foo_render_extra_fields’); function foo_render_extra_fields(){ $term_id = $_GET[‘tag_ID’]; $term = get_term_by(‘id’, $term_id, ‘taxonomy’); $meta = get_option(“taxonomy_{$term_id}”); //Insert HTML and form elements here } add_action(‘edited_taxonomy’, ‘bar_save_extra_fields’, 10, 2); function bar_save_extra_fields($term_id){ $form_field_1 = $_REQUEST[‘field-name-1’]; $form_field_2 = $_REQUEST[‘field-name-2’]; $meta[‘key_value_1’] = $form_field_1; $meta[‘key_value_2’] = $form_field_2; update_option(“taxonomy_{$term_id}”, $meta); } … Read more

Query Custom Post by Taxonomy Category

There are 3 ways of doing that: a) … ‘category_name’ => ‘category-1’ … b) … ‘taxonomy’ => ‘category’, ‘term’ => ‘category-1’, … c) … ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘category-1’ ) ) ) … More info: http://codex.wordpress.org/Function_Reference/WP_Query

Add default WordPress tag meta box to User Profile

This code works for me. It uses ‘locations’ custom taxonomy and ‘suggest’ javascript. You need to extend it to support multiple term selection. Add custom field to user-edit screen and store metadata when user/admin updates profile // for account owner add_action(‘show_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘personal_options_update’, ‘save_custom_user_profile_fields’); // for admins add_action(‘edit_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘edit_user_profile_update’, ‘save_custom_user_profile_fields’); function add_custom_user_profile_fields($user) { printf( … Read more

Adding Category/Tag/Taxonomy Support to Images/Media

Here’s how I recently added a custom taxonomy to the media library as a sortable column: // Add a new column add_filter(‘manage_media_columns’, ‘add_topic_column’); function add_topic_column($posts_columns) { $posts_columns[‘att_topic’] = _x(‘Topic’, ‘column name’); return $posts_columns; } // Register the column as sortable function topic_column_register_sortable( $columns ) { $columns[‘att_topic’] = ‘att_topic’; return $columns; } add_filter( ‘manage_upload_sortable_columns’, ‘topic_column_register_sortable’ ); … Read more

Can you add the visual editor to the description field for custom taxonomies?

Just wrote the function. It’ll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy. /** * Display advanced TinyMCE editor in taxonomy page */ function wpse_7156_enqueue_category() { global $pagenow, $current_screen; if( $pagenow == ‘edit-tags.php’ ) { require_once(ABSPATH . ‘wp-admin/includes/post.php’); require_once(ABSPATH . … Read more