Forums Forums Search & Filter Pro Additional Post Type required

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #42374

    Hi there
    Great plugin, thank you!
    We have a problem though – the WordPress theme that we’re using has a particular Post Type, called Tours, which is not present in your Plugin.

    Here’s the theme FYI: adventure-tours.themedelight.com

    How do we go about searching content of this nature, is there a way for us to introduce a new Post Type so that your plugin can find and search the area that our content is in?

    Let me know if you need more info, thank you!

    Trevor
    #42377

    That is most odd. Are you able to send me admin logins (login url, user, pass), making the post a private reply so that only I can see it?

    Anonymous
    #42389
    This reply has been marked as private.
    Trevor
    #42422

    Hi. I can see the issue and need to refer this to our devs. They may also require ftp access to examine the plugin that sets up the Tours CPT within WooCommerce. So, if you are able to provide those details and credentials, that may speed things up a bit. I will hand ownership of this thread over to Ross for now.

    Ross Moderator
    #42443

    Hey Judy

    I took a look but couldn’t see anything.

    I think the issue is to do with the way your theme changes certain aspects of the Post Type Products – and renaming them to Tours and changing your shop page.

    The first thing I would try to do is disable your other plugins – I know you don’t have an extensive list however its good to cross that off the list.

    Once you’ve done that let me know and if there are still issues we can look into them further – as Trevor said, I might need to request further access details.

    Thanks

    Anonymous
    #42549
    This reply has been marked as private.
    Ross Moderator
    #43026

    Hi Judy

    Ok so I managed to solve the issue 🙂 It wasn’t easy…

    So, let me explain what has happened.

    The results were always being set to 0 because the query for S&F was being “hijacked” by your theme.

    I say hijacked, but its completely standard practise to write filters for modifying queries, but when they are added too loosely, these modifications can have unintended effects.

    Essentially this is a theme issue, and it would probably be a good idea to loop the theme devs back in here.

    Basically, in the class WC_Tour_Query (in the woocommerce/inludes/ folder in your parent theme), there is a pre_get_posts filter which makes some modifications to queries.

    The issue is, it was modifying S&F queries too. The reason this is a theme issue though is because they have this condition:

    if ( ! $q->is_main_query() ) {
    	if ( 'product' == $q->get( 'post_type' ) ) {

    This means, they modify ANY query that is querying the post type “product”. Now this has greater consequences, because any plugin (not just S&F) that makes use of WP_Query (which is pretty common, its a great class) and it happens to be querying the “product” post type, will be modified by your theme. This loose condition has the potential to break an array of different plugins.

    What we do with S&F, to avoid this kind of issue, is to attach a variable to all our queries, and befoer we modify any query we check to see if its there.

    This way there is no chance of modifying something unintended.

    Anyway, as a quick fix, I modified this file around line 33 – and made sure that the query was not modified if it is a query belonging to S&F:

    It was:

    $q->set( 'tax_query', $cur_tax_query );

    And I’ve updated to:

    if(!isset($q->query_vars['search_filter_id']))
    {
    	$q->set( 'tax_query', $cur_tax_query );
    }

    This is the quick fix, the better one is to get your theme authors to take a look at this thread.

    As an FYI, I tried to put this modification in to your child theme (woocommerce/templates/WC_Tour_WP_Query.php) but it wasn’t being picked up, so I made the modification in the parent theme, and created a backup of the previous file called WC_Tour_WP_Query_Bkp.php

    🙂

    PS, if you update your theme, you will lose the changes I have made, you will have to re-apply them with every update unless your theme authors make the modification above.

    I’m happy to talk to them directly and explain further.

    Thanks

    Anonymous
    #43028
    This reply has been marked as private.
    Ross Moderator
    #43321
    This reply has been marked as private.
Viewing 9 posts - 1 through 9 (of 9 total)