Tag: FacetWP

  • Re-centre FacetWP map after interaction

    Useful if the FacetWP map is initially hidden on page load and is only shown after some interaction, meaning that the map markers map be shown but too zoomed out otherwise.

    $('.map-toggle').on('click', function(e) {
        // Apply fitBounds to the Google Map so all markers fit...
        FWP_MAP.map.fitBounds(FWP_MAP.bounds);
    
        e.preventDefault();
    });

  • FacetWP ‘Load More’ button still showing even when no more posts to show

    Make sure you are not overriding the .facetwp-hidden CSS class.


  • PHP function to detect empty index table in FacetWP

    FWP()->helper->get_row_counts();

  • Fixing ApiNotActivatedMapError in FacetWP

    While trying to setup a new Proximity facet in FacetWP I kept receiving the following error when trying to get the suggested search to appear.

    This API project is not authorized to use this API. Places API error: ApiNotActivatedMapError

    I went ahead and enabled the Maps JavaScript API as instructed by Google’s instructions, however this did not solve it.

    Enabling the Places API however, solved the issue. (NB. During debugging I also enabled the Distance Matrix API and the Geocoding API, but not sure if they helped).