Forums Forums Search & Filter Pro Taxonomies not filtering

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #17962

    My filter form includes filtering by custom taxonomy and post types. The results are correct when the post types are selected, but it just shows all results when I try to filter by a taxonomy term.

    When filtering by post type, I do see “?post_types=em_article&sfid=399” appended to the url, but when filtering by taxonomy term I only see “?sfid=399” appended. Also, I have specified the URL to the post/page where the results shortcode can be found, but when I hit submit on the form, the URL query string gets appended to the homepage.

    Also, the auto-form-submit is not working.

    I have tried switching on and off AJAX, is_search, and other options, but no luck.

    Ross Moderator
    #18001

    Hey Alex can you send me a link to a page with the search form on it?

    Thanks

    Anonymous
    #18030
    This reply has been marked as private.
    Ross Moderator
    #18031

    Am I missing something, this page looks blank to me?

    Thanks

    Anonymous
    #18032

    I just uploaded what I was working on locally, so it should be up now.

    Anonymous
    #18038

    I really need to get this working ASAP.

    My custom taxonomy terms are showing up, but it looks like they aren’t included in the query. Does this have anything to do with any args in my create taxonomies function in my functions file?

    Are there any WP page/search templates that I *need* to include in order for this to work the shortcode way?

    Anonymous
    #18050

    I’ve switched it from shortcode to archive page, and I created a template for this page.

    The query at the top of this page is an example from the WP codex:

    <?php
    global $query_string;

    $query_args = explode(“&”, $query_string);
    $search_query = array();

    foreach($query_args as $key => $string) {
    $query_split = explode(“=”, $string);
    $search_query[$query_split[0]] = urldecode($query_split[1]);
    } // foreach

    $search = new WP_Query($search_query);
    ?>

    Is there something I should add to this in order for it to add the taxonomy term to the query?

    Anonymous
    #18051
    This reply has been marked as private.
    Ross Moderator
    #18052

    Hi Alex

    The shortcode method will probably work best – you weren’t doing anything wrong I don’t htink.

    Looking at your source code I can see that for some reason the JS files relating to S&F are not present in the page (the css files are there though… )

    If you take a look at the source of the page I would expect that at least

    search-filter-plugin-build.js would be there – but it is not. This is exactly the reason nothing is working.

    If I take a look at my local installation I see S&F adds this to the source:

    <script type='text/javascript'>
    /* <![CDATA[ */
    var SF_LDATA = {"ajax_url":"http:\/\/localhost\/wpsearchandfilter\/wp-admin\/admin-ajax.php","home_url":"http:\/\/localhost\/wpsearchandfilter\/","sfid":"0"};
    /* ]]> */
    </script>
    <script type='text/javascript' src='http://localhost/wpsearchandfilter/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.js?ver=1.4.3'></script>
    <script type='text/javascript' src='http://localhost/wpsearchandfilter/wp-content/plugins/search-filter-pro/public/assets/js/chosen.jquery.min.js?ver=1.4.3'></script>

    It loads 2 scripts, and initialises some JS variables.

    You could try adding these scripts back in manually?

    It seems like something is stripping them out of your theme.

    To load all S&F js correctly and in the right order you could try using wp_enqueue_script – the code would be something like this:

    	wp_register_script( 'search-filter-plugin-build', 'http://www.yoursite.com/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.js', array('jquery'), '1.4.3' );
    	wp_localize_script('search-filter-plugin-build', 'SF_LDATA', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'home_url' => (home_url('/')), 'sfid' => '' ));
    	
    	wp_register_script( 'search-filter-chosen-script', 'http://www.yoursite.com/wp-content/plugins/search-filter-pro/public/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.4.3' );
    	
    	wp_enqueue_script( 'search-filter-plugin-build' );
    	wp_enqueue_script( 'search-filter-chosen-script' );
    	wp_enqueue_script( 'jquery-ui-datepicker' );

    Obviously remember to update the URLs in there to the correct paths.

    Hope that helps!

    Anonymous
    #18053

    This script worked. Thanks!

    I had to insert ‘/public’ into the paths to the js files, and the first one was missing a ‘.js’ at the end, but afterwards the filtering started working.

    Thank you!

Viewing 10 posts - 1 through 10 (of 11 total)