• Resolved duanecilliers

    (@duanecilliers)


    Currently the filtered results are displayed using taxonomy.php. I have several custom post types, but I’m only using this plugin to filter taxonomies within the Documents custom post type.

    taxonomy.php is used for other taxonomies, so I’m unable to customize that template to my liking without messing up the display of other taxonomies.

    Is there a way to specify which template is used to display the filtered results?

    One more issue. I tried setting the base URL to my documents page using the following code in my themes functions.php

    function my_qmt_base_url( $base ) {
       return get_page_link( 22 );
    }
    add_filter( 'qmt_base_url', 'my_qmt_base_url' );

    It was successful in setting the base URL, but now when I select terms to filter the search and hit Filter, the URL query seems correct, but the actual page is just refreshed with no changes to results.

    Any help is greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author scribu

    (@scribu)

    One way to do it would be to add something like this in your functions.php file (not tested):

    // Load a different template for document taxonomies
    function document_taxonomy_template() {
      $queried_taxonomies = array_keys( qmt_get_query() );
      $matching_taxonomies = array_intersect( $queried_taxonomies, array( 'taxonomy-a', 'taxonomy-b', 'another-taxonomy' ) );
    
      if ( !empty( $matching_taxonomies ) ) {
        locate_template( 'document-taxonomy.php', true );
        die;
      }
    }
    add_action( 'template_redirect', 'document_taxonomy_template', 11 );

    So, document-taxonomy.php would be loaded if any of ‘taxonomy-a’, ‘taxonomy-b’, ‘another-taxonomy’ were queried.

    Thread Starter duanecilliers

    (@duanecilliers)

    Thanks for the reply Scribu ?? I will try this out and let you know how it goes.

    Thread Starter duanecilliers

    (@duanecilliers)

    Works perfectly. Thanks Scribu ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Filtered Results on Custom Template’ is closed to new replies.