Forums Forums Search & Filter Pro Results of Search & Filter Pro in Marketify

Viewing 6 posts - 21 through 26 (of 26 total)
  • Anonymous
    #14777

    Hi! I’ve talk to someone at Astoundify for the marketify template. And he tell me that: “The theme will load the grid results if you pass ?post_type=download via the URL. If you look in search.php you can see how it decides which template to load.” But I don’t know how to configure it. This is the search.php:

    <?php
    /**
    * The template for displaying Search Results pages.
    *
    * @package Marketify
    */

    $post_type = get_query_var( ‘post_type’ );

    if ( ‘download’ == $post_type )
    locate_template( array( ‘archive-download.php’ ), true );
    else
    locate_template( array( ‘index.php’ ), true );

    Can you help with that?

    Thank you

    Ross Moderator
    #14778

    Hey Stephane so it looks like this part:

    if ( ‘download’ == $post_type )
    locate_template( array( ‘archive-download.php’ ), true );
    else
    locate_template( array( ‘index.php’ ), true );

    is the part you want to change… I would remove the above leaving just this line:

    locate_template( array( ‘archive-download.php’ ), true );

    So from your code above it would look like:

    <?php
    /**
    * The template for displaying Search Results pages.
    *
    * @package Marketify
    */
    
    $post_type = get_query_var( ‘post_type’ );
    
    locate_template( array( ‘archive-download.php’ ), true );
    

    This means it will always load archive-download.php which I think has the layout you want..!

    (can I set your post to public so Mike can read it? Doesn’t seem to be anything sensitive in there :))

    Anonymous
    #14779

    The problem with this is: I get the layout BUT the search Query is not good. It give me all my downloads and it suppose to be only 2 for that query. So, the layout is correct but it don’t search correctly. Do you have any idea why????

    And yes you can it Public for Mike!

    Ross Moderator
    #14782

    Hey Stephane

    Haha, now I think we’re kind of going round in circles – the template is now being loaded, BUT, I think there is a custom query somewhere in there that is being used – which overwrites the search query, maybe you could ask the theme developers where to remove the query so that the template uses results created by the default WP Loop (https://codex.wordpress.org/The_Loop)?

    Thanks

    Anonymous
    #14882

    That was the answer from Astoundify: The template that is loaded uses the [downloads] shortcode provided by Easy Digital Downloads which creates its own loop. Marketify detects if a search is being performed and filters their custom loop/query. I would imagine a similar thing would need to be done via the Search & Filter plugin.

    Ross Moderator
    #14998

    Hi Stephane

    If you check back all the way to the beginning of this thread you will notice that I mentioned that the custom query looks hidden behind a shortcode – and that S&F cannot work with templates this way – S&F cannot use a template that has another query inside it, because the query inside overwrites the search results that you would normally find.

    This means you either have to:

    a) modify your template/theme and remove the query for the search results page – but it looks like this is tricky with your theme.

    b) display the results using the shortcode option under “display results” – however this will not get the style from your theme automatically – it will require someone with html/css knowledge to customise and use your existing layout.

    I will take a look in to this though to see if its a query I could get S&F to hook into.

    Thanks

Viewing 6 posts - 21 through 26 (of 26 total)