WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
Show all custom type if no filters selected (9 posts)

  1. korymath
    Member
    Posted 2 years ago #

    Is there an easy way that I can show all of a certain custom type if none of the filters are selected?

    The demo site is live and running at http://madebyflagship.com/asapp/slp-listings/ but when Submit is hit without selecting any of the filters, then it takes me to the blog page that I have set up rather to a page with all the certain taxonomy.

    Thanks for the help.

    Kory

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

  2. korymath
    Member
    Posted 2 years ago #

    It is almost as if the Submit button jumps right to archive.php ignoring possible alternatives like taxonomy-member.php or even just taxonomy.php.

    Any one able to provide some advice?

    Kory

  3. glk
    Member
    Posted 1 year ago #

    I see, you found the answer. Can you share it with us? I have the same problem; want to show all of the products when no dropdown is marked and the searchbutton is hit.

  4. thhhhh
    Member
    Posted 1 year ago #

    I'd love to know this as well.

  5. korymath
    Member
    Posted 1 year ago #

    This was done with just submitting an empty query, and ensuring that my archive for custom post type member was built out. It will jump to a default archive for a custom post type if no special template is defined.

  6. thhhhh
    Member
    Posted 1 year ago #

    Thanks for the reply... I think you may have had a different problem than the one I'm trying to solve. I've already built a CPT archive specific to each of my post types, but submitting an empty query seems to just take me to a page built from index.php. I guess my problem is that I'm struggling to find a way to include my CPT in the query string automatically.

    Basically, I've got a few custom taxonomies (resource_type, topics, timeline) which I want to query within a CPT called 'resource'.

    I can access the cpt archive by going to http://site.com/?post_type=resource

    But when I make my query I lose this parameter... I get a query string that looks like, for example, "http://site.com/?resource_type=magazine-article&topics=&timeline="

    What I want is to have the resource archive automatically add "?post_type=resource" to query strings, resulting in query strings like this: "http://site.com/?post_type=resource&resource_type=magazine-article&topics=&timeline="

    One way to solve this would be to add a dropdown for post types, but for some reason I can't seem to get this to appear.

    Sorry if this is the wrong place for all this... I think I may have to start my own support thread.

  7. korymath
    Member
    Posted 1 year ago #

    Probably best to start your own thread, are you using http://wordpress.org/extend/plugins/query-multiple-taxonomies/

    What are the multiple types that you want to query, this is probably because query strings are specific to the type.

  8. thhhhh
    Member
    Posted 1 year ago #

    Yeah, I'm using version 1.62 of QMT.

    I want to query 'resource', 'people', 'animation', 'studios' and 'wiki', depending on if I'm in the resource, people, animation, studios, or wiki archives, respectively.

    Following this (http://wordpress.org/support/topic/plugin-query-multiple-taxonomies-base-url-problem?replies=6#post-3452905) I've come up with the following code... though it doesn't seem to actually affect my queries.

    if ( is_post_type_archive() ) {
    
        $CPTquery = get_post_type( $post->name );
    }
    
    function my_qmt_base_url() {
    	return '../?post_type=' . $CPTquery;
    }
    add_filter( 'qmt_base_url', 'my_qmt_base_url' );
  9. thhhhh
    Member
    Posted 1 year ago #

    Still struggling but after a few hours I think that the code looks closer to what it should:

    function my_qmt_base_url() {
    	if (is_post_type_archive()) {
    		$CPTquery = get_post_type( $post->name );
    }
        return add_query_arg( 'post_type', $CPTquery );
    }
    add_filter( 'qmt_base_url', 'my_qmt_base_url' );

    I've started a new thread so not to monopolize this one: http://wordpress.org/support/topic/make-empty-queries-filter-automatically-by-custom-post-type-of-archive?replies=1#post-3453695

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic