Support

Account

Home Forums Front-end Issues Issue on result page with Facewp

Solved

Issue on result page with Facewp

  • Hello,

    Hello, I have build a search/result page with FacetWP and ACF.

    On the result page I add the possibility to edit one specific repeater fields of each result listed.

    To do that I include in the FacetWP loop this code:

    <?php
    	acf_form_head();
    	$options = array(
    		'post_id'       => $post->ID,
    		'post_title'    => false,
    		'post_content'  => false,
    		'field_groups' => array('group_6166044822675'),
    		'fields' => array('field_6166066864387'),
    	);
    	acf_form($options);
    ?>

    That is working on the main search page with the default result.
    The repeater fields is present for each result find and I’m able to add or edit the repeater fields.

    When I refine the result to show only the result of the year 2020 or any other specification with a Facet, again all repeater fields are present, filled with the right data.

    But this time the “add row” and “Update” button doesn’t work.

    But if I do a page refresh (F5) the “add row” and “Update” button are functional.

    I can’t find what going on. Did this is an issue of my code or of FacetWP?

    Any idea?

    Thanks

  • UPDATE ***

    I found a solution by adding this JS in the main search page. it’s not a pretty one but it’s working pending a better solution.

    <script>
    (function($) {
        $(document).on('facetwp-refresh', function() {
            if (FWP.loaded) { // after the initial pageload
                FWP.parseFacets(); // load the values
                FWP.setHash(); // set the new URL
                location.reload();
                return false;
            }
         });
    })(jQuery);
    </script>
  • Please delete this thread !!

    THX

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

You must be logged in to reply to this topic.