Support Forums

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

Forums Forums Search & Filter Pro Get current form ID

Viewing 7 posts - 1 through 7 (of 7 total)
  • mike distras
    #234371

    Is it possible to simply reference for current/active form id number in the search results template?

    eg:
    data-search-form-id=”<?php echo formID(); ?>”

    Trevor Moderator
    #234391

    I do not think this is possible, no.

    Ross Moderator
    #234436

    Hi Mike

    This is actually possible, it’s stored inside the query:

    $query->query_vars['search_filter_id']

    🙂

    mike distras
    #234825

    Oh!

    So this is probably more of a noob PHP question, how would i echo that data/number out in to a field?

    Im trying to hardcode a the Reset field in to a theme:

    <a href="#" class="search-filter-reset" data-search-form-id="FILTER ID" data-sf-submit-form="always">Clear all</a>

    Trevor Moderator
    #234829

    <a href="#" class="search-filter-reset" data-search-form-id="<?php echo $query->query_vars['search_filter_id'];?>" data-sf-submit-form="always">Clear all</a>

    mike distras
    #234831

    Ah that was the first thing i tried before coming back here. It didnt output anything.

    Im probably outside of the initial query/loop for the filters, is there another way to call it while outside?

    <?php echo do_shortcode('[searchandfilter slug="' . $page_type . '"]'); ?>
    
    <a href="#" class="search-filter-reset" data-search-form-id="<?php echo $query->query_vars['search_filter_id'];?>" data-sf-submit-form="always">Clear all</a>
    Trevor Moderator
    #234838

    Use JavaScript to grab it from the form and add it outside. But, that is a bit too complicated for me.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.