Title: Multi-select Fields?
Last modified: September 1, 2016

---

# Multi-select Fields?

 *  Resolved [Agrajag27](https://wordpress.org/support/users/agrajag27/)
 * (@agrajag27)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/multi-select-fields/)
 * Thanks again for the great plugin. We’ve communicated before and you’ve been 
   a great help. We heavily use the plugin in a different way than most where we
   might call it five times on a single page for different fields (movie review 
   site):
 * [http://slashcomment.com/movie-reviews/a-bigger-splash-review/](http://slashcomment.com/movie-reviews/a-bigger-splash-review/)
 * One thing we’d like to get is the ability to select just two fields for results.
   In the example above, “Other Similar Films” is driven by our custom “Keywords”
   field, but it would be much improved if that result could also include our custom“
   Genre” field as well. However, there’s no UI way to select two fields. It’s either
   all fields or one field.
 * Can this be easily overcome?
 * Thanks!
 * [https://wordpress.org/plugins/related-posts-by-taxonomy/](https://wordpress.org/plugins/related-posts-by-taxonomy/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/multi-select-fields/#post-8138267)
 * Hi agrajag27
 * Do you need this for the widget only?
    One way is to add a new format for the
   widged by using something similar to this in your (child) theme’s functions.php
 *     ```
       // Create new format keyword_genre for use in widget and shortcode
       add_action( 'wp_loaded', 'rpbt_add_keyword_genre_format', 11 );
   
       function rpbt_add_keyword_genre_format() {
   
           if ( !class_exists( 'Related_Posts_By_Taxonomy_Defaults' ) ) {
               return;
           }
   
           $defaults = Related_Posts_By_Taxonomy_Defaults::get_instance();
   
           // Add the new format .
           $defaults->formats['keyword_genre'] = __( 'Keyword and Gengre' );
       }
       ```
   
 * With this you can select the new format Keyword and Gengre in the widget
    Now
   we have to let the plugin know what taxonomies to use when we use this format.
   Put this in your (child) theme’s functions.php
 *     ```
       add_filter( 'related_posts_by_taxonomy_widget_args', 'my_widget_filter', 10, 2 );
       function my_widget_filter( $args, $instance ) {
   
           if( 'keyword_genre' === $args['format'] ) {
               $args['taxonomies'] = array( 'keyword', 'genre' );
           }
   
           return $args;
       }
       ```
   
 * btw:
    consider creating a [child theme](http://codex.wordpress.org/Child_Themes)
   instead of editing your theme directly – if you upgrade the theme all your modifications
   will be lost. Or [create a plugin](https://wordpress.org/plugins/pluginception/)
   with the code above.
    -  This reply was modified 9 years, 9 months ago by [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/).

Viewing 1 replies (of 1 total)

The topic ‘Multi-select Fields?’ is closed to new replies.

 * ![](https://ps.w.org/related-posts-by-taxonomy/assets/icon.svg?rev=1115231)
 * [Related Posts by Taxonomy](https://wordpress.org/plugins/related-posts-by-taxonomy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related-posts-by-taxonomy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related-posts-by-taxonomy/)
 * [Active Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related-posts-by-taxonomy/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/multi-select-fields/#post-8138267)
 * Status: resolved