Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tremendous Taxonomies

Tremendous Taxonomies

Taxonomies have been around in WordPress for a long time as a way of grouping things together, but did you know there is a lot you can do with taxonomies which you may not know? In this talk I will outline what taxonomies are and how you can create your own custom taxonomies. I will share some use cases for having custom taxonomies as well as some different and interesting ways in which I have used taxonomies on some sites in the past. In addition I will looks at some of the ways in which you can optimise the admin UI for taxonomies, making it more appropriate in some cases. The talk will also look at how you can associate data with different taxonomy terms.

Mark Wilkinson

October 22, 2016

More Decks by Mark Wilkinson

Other Decks in Technology


  1. Default Taxonomies Categories / category Tags / post_tag Link Category

    / link_category Post Formats / post_format Menus / nav_menu
  2. $news = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page =>

    -1, ‘meta_query’=> array( array( ‘key’ => ‘home_slider’, ‘value’ => ‘yes’ ) ) ) );
  3. $news = new WP_Query( array( ‘post_type’=> ‘post’, ‘posts_per_page => 100,

    ‘tax_query’ => array( array( ‘tax’=> ‘locations’, ‘field’=> ‘slug’, ‘terms’=> ‘home-slider’ ) ) ) );
  4. User Bookmarks Logged in users can bookmark posts The are

    saved into a bookmarks page for each user Bookmarked posts can be removed from this page
  5. $post_id = absint( $_POST[ 'postid' ] ); $user_id = absint(

    $_POST[ 'userid' ] ); $term = get_term_by( 'slug', 'user-' . $user_id, 'hd_bookmark' ); if( $term != false ) { wp_set_object_terms( $post_id, $term>term_id, 'hd_bookmark', true ); }
  6. $post_id = absint( $_POST[ 'postid' ] ); $user_id = absint(

    $_POST[ 'userid' ] ); $term = get_term_by( 'slug', 'user-' . $user_id, 'hd_bookmark' ); if( $term != false ) { wp_remove_object_terms( $post_id, $term- >term_id, ‘hd_bookmark ); }