Also we added conditional logic for restricting the query arguments for a particular template named âexperts_templateâ. The code below hides the facet if itâs empty. It shows/hides the post listing based on whether there are facet query. If you need to always hide the listing when no facet choices are selected, use the following code. When you de-select all facet choices, or use the Reset facet button/link, the listing will still show. FacetWP displays the filter regardless of whether thereâs anything to filter. The above solution only hides the post listing on inital page load. FacetWP is an advanced filtering plugin for WordPress that allows you to add faceted search to you WooCommerce sites, listing pages, resources pages. For instance, the Open and Closed status at the bottom is a taxonomy on the âcaseâ content type. The Query arguments array (used by WP_Query) tells WP which posts to retrieve from the database.Īs an example, in this hook we have a query argument for filtering the employees with the âpractice_areaâ taxonomy attached to it. Some of the filters weâve added only apply to certain content types. FWP.frozenfacets shows the filter that was giving me issues. FacetWP plugin for sorting/filtering the resource and TranslatePress for translation. facetwp-counter span Improved extra javascript. Add translation to the checkbox labels, and complete the translation.Ä£. 1/ Browse to Settings > FacetWP, click the Templates tab, select the template which you are using, then copy and backup the code in Display Code to. New facetwppreloadurlvars hook for better facet pre-select New WooCommerce Product Type data source New facet base class (FacetWPFacet) with a getorderby() method Improved fail gracefully if an invalid post ID is passed to the indexer Improved fSelect counts are now within a. Translate the post with the Advanced Translation Editor.Ä¢. And under the FacetWP section `Enable FacetWP`.Ä¡. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. Add a Shortcode element and insert the Facet shortcode.Ä£. How to use custom PHP code PHP code can be added to your (child) theme's functions.php file. The code also demonstrates the use of the FWP.loaded variable in a condition. Because the facetwp-loaded event fires after each AJAX page load, the page will scroll when any facet is used. Add a new Facet: Ensure to select Facet type = Checkbox and Data source = Field name.Ä¢. The following example scrolls the page to the top of the results (the element with class facetwp-template), after each facet interaction. Create a post and select the checkbox's choices and publish the post.Ä¢. In the Choices field, add at least one choice for example like this boy : Boy.Ä¡. Create a field group and add a checkbox field to it.Ä¢. FacetWP - translated checkbox labels are not rendered with shortcodes.Ä¡.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |