Forums Forums Search Search Results for 'conditional logic'

Viewing 9 results - 11 through 19 (of 19 total)
  • Author
    Search Results

  • Trevor
    Participant

    I can see that the form is in the page sidebar. Did you add it there in Widgets -> Sidebars?

    In which case, it looks like your theme probably uses the same sidebar on all pages. You would need to make the appearance of the widget conditional using a plugin like this:

    https://en-gb.wordpress.org/plugins/widget-logic/

    It depends which pages in WooCommerce you would want to show it on, but if you want all WooCommerce pages I think the logic code is is_woocommerce()

    But, the variations of rules you can apply are endless.

    #213536

    Ross
    Keymaster

    Hi Bjorn

    S&F already has this option – check settings -> lazy load Javascript

    This means, JS will not be loaded until a search form is present on the page somewhere.

    However, with CSS, this is not strictly possible.

    CSS should be loaded in the head of a page, however, sometimes we do not know if a page contains a search form, until some of the body (ie, on of our shortcodes) has already been printed… which means its not possible (whilst keeping to standards) to conditionally load our CSS, unless we want to print it inline.

    My recommendation is to enable lazy load Javascript, and then conditionally unload our CSS, based certain rules so you know it only shows it on the page with the search form on.

    As far as I’m aware, this is not considered bad practice – if you can share any better methods / logic of approaching this I’d be happy to hear 🙂

    Thanks

    #211310

    Anonymous
    Inactive

    It worked. I forgot to get back to you but for anyone else looking for conditional search & filter display it’s easy enough to duplicate your main filter, make whatever edits you want for an archive page etc.. (E.g. for me on the video archive page I wanted to exclude all text and audio categories so I created a video archive filter from a duplicate of my main -all cats- filter.) Then use the widget logic plugin in a sidebar to show the appropriate filter if is_category(’16”) or is_home().

    All set now thanks.

    Alice

    #210861

    Anonymous
    Inactive

    I thought of a good solution in the night and will test it today.

    I’ll use the widget logic plugin and duplicate the filter so I have a home, video, audio, and text version of the search/filter.

    In each version of the duplicate search/filter I will exclude the other main categories from the top category field.

    Then I’ll just use the widget logic to find out if it’s the home page – show the home search/filter version, if it’s video archive show that version and so on.

    Should work. Will confirm.

    Thanks,

    Alice

    p.s. I won’t bother doing it for all the taxonomies, just those top level category archives. For another version it would be great to have the cat/tax conditional built in so if you are on tax id 5 only show results of 5 and it’s children and exclude the other tax siblings and ancestors.

    #172831

    Anonymous
    Inactive

    I’m wondering if there is a way to add conditional logic to individual posts? I have a date range search for tours that have a 4 month window within the date-range where the tour is NOT available…

    EX: Portugal Cycle Tour Dates: April 5 – 28 2018 & September 29 – October 6 2018

    The client does not want to duplicate tour pages. Since we cannot use repeater fields with S&F to add multiple date ranges to each tour, I was hoping to add a ‘blackout’ date range with the compare mode or conditional logic.

    Something like…

    Input must be within post-meta range BUT NOT if within start-blackout and end-blackout

    Hoping this makes sense?!

    Thanks in advance.

    #171379

    Ross
    Keymaster

    Hi there

    I figured the solution.

    Your theme has this function _st_list_categories_without_title, which, it seems to (unintentionally perhaps) filter every single wp_list_categories

    I don’t understand the logic of the function, but they seem to destroy and recreate the taxonomy list for perhaps a particular style of formatting.

    Anyway, we use that function in our plugin, and it caused some errors because we use the walker argument with wp_list_categories.

    I managed to figure a workaround though, which is to remove the walker setting from your themes _st_list_categories_without_title function.

    You can override their function (and use my modification) by adding this to your child theme-

    function _st_list_categories_without_title( $output, $args ) {
    	$defaults = array(
    		'echo'               => 0,
    		'use_desc_for_title' => 0,
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    
    	$r['use_desc_for_title'] = 0;
    	$r['echo']               = 0;
    	$r['walker']             = ''; //this is the only change I made
    
    	remove_filter( 'wp_list_categories', __FUNCTION__, 11 );
    	
    	$output = wp_list_categories( $r );
    
    	add_filter( 'wp_list_categories', '_st_list_categories_without_title', 11, 2 );
    
    	return $output;
    }

    I’m not sure if it will have unintended consequences in your theme though (and I’m sure this filter needs to be applied conditionally rather than globally), so it would be best to direct your theme author to this post – I would be happy to discuss with them this code and my suggestion.

    Thanks

    #171374

    Ross
    Keymaster

    Hi there

    I figured the solution.

    Your theme has this function _st_list_categories_without_title, which, it seems to (unintentionally perhaps) filter every single wp_list_categories

    I don’t understand the logic of the function, but they seem to destroy and recreate the taxonomy list for perhaps a particular style of formatting.

    Anyway, we use that function in our plugin, and it caused some errors because we use the walker argument with wp_list_categories.

    I managed to figure a workaround though, which is to remove the walker setting from your themes _st_list_categories_without_title function.

    You can override their function (and use my modification) by adding this to your child theme-

    function _st_list_categories_without_title( $output, $args ) {
    	$defaults = array(
    		'echo'               => 0,
    		'use_desc_for_title' => 0,
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    
    	$r['use_desc_for_title'] = 0;
    	$r['echo']               = 0;
    	$r['walker']             = ''; //this is the only change I made
    
    	remove_filter( 'wp_list_categories', __FUNCTION__, 11 );
    	
    	$output = wp_list_categories( $r );
    
    	add_filter( 'wp_list_categories', '_st_list_categories_without_title', 11, 2 );
    
    	return $output;
    }

    I’m not sure if it will have unintended consequences in your theme though (and I’m sure this filter needs to be applied conditionally rather than globally), so it would be best to direct your theme author to this post – I would be happy to discuss with them this code and my suggestion.

    Thanks

    #135091

    In reply to: Conditional Logic


    Trevor
    Participant

    True conditional logic is not an advertised feature of our plugin. However, it does support Quasi conditional logic, which is what most sites use.

    Let me take the example of your two taxonomies (they must be two separate taxonomies, and not one taxonomy with multiple parent/child relationships – if you have done this, it can easily be changed into two taxonomies); Provinces and Towns.

    When the page with the form opens, both fields would be visible, populated with all possible variations of terms.

    When the user makes a selection in the Province field, the Town field updates to show only the towns in that province. Also, if the user selects a town first, the Province field would update to show the correct province.

    This is done by:

    1. Enabling (ON) the two Auto Count settings in the General Settings tab, and
    2. On each field, set Hide Empty to ON.

    We do it this way because WordPress does not maintain referential data integrity in its database, which is what is required for True Conditional Logic (although it can be faked). Instead the ‘joins’ are in each post where you select terms for each field and thus create the ‘link’.

    #102512

    Anonymous
    Inactive

    Hello.

    I have a problem with Safari browser. It seems like ignoring “Conditional Logic” rules. I have made a question (radio buttons) with 3 possible answers. When I click any of them, a new one appears. Although it works perfect in IE/Chrome/Mozilla, in Safari I see all 4 questions at once. Could you please help me?

    Thanks!!

Viewing 9 results - 11 through 19 (of 19 total)