Support Forums

Looking for support? You can access the support system via your account.

Jordan

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 27 total)
  • Jordan in reply to:
    How to import a search form from another wp project?
    #221052

    Trevor clearly answered this in the thread link you posted above:

    You will not be able to export/import the form. If you did, your live site would most likely allocate it a new Post ID. It is not our plugin that allocates such IDs.

    The form will be given an ID when it is created, like anything in WordPress. If you imported a form with a specific ID but that ID was already taken by something else on your site like a post, page, attachment etc, it would conflict.

    Jordan in reply to:
    A lot of checkbox or radio button: Show more / Show less
    #221050

    Would love to see the JavaScript for this if possible (when done) Nicolas, thanks 🙂

    Jordan in reply to:
    Dynamically update Results URL
    #219188

    I realised that the results_url is simply a piece of post meta, meaning I could just:

    Grab the form ID
    Provide the meta key to update
    Build a new url base

    if ( $sfid == 29 ) {

    // Dynamically update the search-and-filter results url.
    $meta_key = ‘_search-filter-results-url’;
    $results_url = home_url() . ‘/’ . ‘shop/’ . $store_user->data->user_nicename;

    update_post_meta( $sfid, $meta_key, $results_url );
    }

    This works great, however just thinking if it’s suitable. If 10 people load a different shop url all at once, that post meta is going to rapidly change.

    Anyway just providing my solution so far and open to thoughts ideas if needed.

    Jordan in reply to:
    Filter by meta_query custom field
    #217833

    I changed the value on that post but works regardless, can’t edit the last reply.

    Jordan in reply to:
    Filter by meta_query custom field
    #217831

    Currently I am not simply for dev purposes. However I just fixed the issue moments ago! That’s 2 fixes today for me, I am on a roll haha.

    Does not seem I was writing the meta_query correctly:

    Before:

    
    $meta_query = [
        'key'     => '_liked',
        'value'   => '1',
        'compare' => 'LIKE',
      ];
    
    $query_args['meta_query'] = $meta_query;
    

    After

    
    $query_args['meta_query'] = array(
        array(
          'key'     => '_liked',
          'value'   => '4',
          'compare' => 'LIKE',
        ),
      );
    

    For now decided to not do the declare at the top and then pull in below. This works so I’ll run with it for now.

    Thanks for the responses Trevor, always appreciated.

    Jordan in reply to:
    Filter by meta_query custom field
    #217825

    I am using the same filter to modify the main shop search too. This one works fine:

    
    function update_search_category( $query_args, $sfid ) {
    
      $query_args['tax_query'] = array(
        array(
          'taxonomy'      => 'product_cat',
          'terms'         => '20',
          'operator'      => 'IN',
        ),
      );
    
      return $query_args;
    
    }
    add_filter( 'sf_edit_query_args', __NAMESPACE__.'\\update_search_category', 20, 2 );
    
    Jordan in reply to:
    Filter by meta_query custom field
    #217817

    Because I am in a namespaced file.

    Why PHP Namespaces

    In short, PHP namespaces address the problem of isolation. Before they were introduced to PHP, if you had a function, class, or constant called, say, Validation_Error in one part of your code, you simply couldn’t have another one like that anywhere else.

    Jordan in reply to:
    Search options not working with ACF
    #217760

    Trevor – Question regarding your notes on selecting the correct ACF meta key:
    https://support.searchandfilter.com/forums/topic/search-options-not-working-with-acf/#post-217575

    In our Post Meta form object Meta Key selection list, you need to use key #3

    Should we also be using the non underscore keys when we’re modifying the query via sf_edit_query_args too?

    Jordan in reply to:
    Filter by meta_query custom field
    #217710

    It’s added to my functions.php file in the parent theme not child, I am building my own theme, no need for a child theme here.

    Jordan in reply to:
    Filter by meta_query custom field
    #217706

    Yes it is a function, I was just showing you only the parts which you needed to see, here is it all:

    
    /**
     * USER PROFILE - Modify search form args
     */
    function user_liked_products_search_filter( $query_args, $sfid ) {
    
      if ( $sfid == 26 ) {
        $query_args = array (
          'meta_query' => array(
            array(
              'key'       => '_likes',
              'value'     => 1,
            ),
          ),
        );
      }
    
      return $query_args;
    
    }
    add_filter( 'sf_edit_query_args', __NAMESPACE__.'\\user_liked_products_search_filter', 100, 2 );
    
Viewing 10 posts - 1 through 10 (of 27 total)