Facetwp custom facet. GitHub Gist: instantly share code, notes, and snippets.

Facetwp custom facet Sep 2, 2024 · How to use custom PHP code? PHP code can be added to your (child) theme's functions. Data source: Where it will get necessary data from. Add a custom attribute to a facet. Enter the appropriate values in the form that appears on the Add Facet page. The following example can be used to add a role="status" attribute to the HTML of a “Result counts” type Pager facet. If you’ve been to any eCommerce site, you’ve probably seen those UI elements (checkboxes, dropdowns, price ranges) that let you narrow down the results. This plugin causes the following compatibility issue when using FacetWP with WooCommerce on product category archives that have a Dec 10, 2024 · The Proximity facet type; Using the facetwp_i18n hook to translate facet labels and strings; The Pager + Load more facet type; Using FacetWP with Advanced Custom Fields; Using FacetWP with WP Job Manager; Using FacetWP with the Listify theme; Using FacetWP with the Listable theme; How to disable facet auto-refresh and add a submit button; The Sep 4, 2024 · FacetWP can only index and filter posts (of any (custom) post type). As users is not a post type, the add-on adds a new hidden upt_user custom post type, and adds a post for each user. FacetWP supports the following listing template types: Using a WP archive page; Using a custom WP_Query Nov 14, 2024 · The facetwp_facet_orderby hook; The Search facet type; The Autocomplete facet type; The Radio facet type; The facetwp_facet_html hook; The facetwp_shortcode_html hook; The facetwp_facet_display_value hook; Custom facet types Nov 11, 2024 · Overview. Modify the choices within the Data source dropdown of facets and Listing Builder items, in the FacetWP settings. When choosing a hierarchical taxonomy, read this warning. For example, to pre-select audi in the ‘make’ facet if the current page URI is demo/cars and the facet isn’t already in use, add the following code to your (child) theme’s functions. We improved the Import/Export feature selection options and UI. First, edit your facet (Settings > FacetWP) and set the “Sort by” option to “Term Order”. Yes, FacetWP supports listing and filtering of posts, pages, and any custom post type (as long as it is searchable). FacetWP uses this special argument to automatically detect this query as the main query to use for filtering. My Account Support Sales About Us Aug 6, 2024 · A listing template tells FacetWP which posts to filter. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. Oct 22, 2024 · How to use custom PHP code? PHP code can be added to your (child) theme's functions. We generally recommend using Advanced Custom Fields (ACF). Click the Save Changes button. • The “Strict query detection” setting is now enabled for new installs, preventing most automatic query detection issues. If the source of the builder item is a custom field that outputs an array (for example an ACF Checkboxes or Taxonomy field), FacetWP will automatically output the array values as a comma-separated string. Fix the Pager facet on product category archives. php If you prefer to keep your license key in code, you can add it to wp-config. After adding some products, go to Settings > FacetWP and click the “Add facet” link. Supported listing templates. The FacetWP Facet widget The FacetWP Elementor Facet widget settings. Additionally, with a Professional license you can install the User Post Type add-on, which allows you to map users to a post type, and therefore filter users. If you need to do this in a PHP template, you can add the facets with PHP too. To check if facets are working okay in general, create a test facet with its Data Source set to “Post Type” and re-index. 2 days ago · If you forgot which email address you used for your account, open a support ticket from within the plugin settings. 5 days ago · The Time Since facet type can be used to filter posts by date / time since a specified interval. Using this method, the facet/listing will render as a normal processed shortcode in the frontend, and as an unprocessed shortcode block in the block editor: Nov 25, 2024 · FacetWP has an automatic indexer that performs a single re-index when an individual item (a post, page, and category or term name/slug) is edited or saved. My Account Support Sales About Us Next, add some facets to the page. Demo Buy. Installation. Download the add-on from the Meta Box website; Install and activate FacetWP, Meta Box, and this add-on; Browse to Settings > FacetWP to add a new facet Oct 23, 2024 · Name Description; Data source: The Data source should be a custom field containing a comma-separated latitude, longitude. Nov 25, 2024 · To check which post types FacetWP currently indexes, click the “Show indexable post types” button in the settings, as shown in the image on the right. When editing the page via Beaver Builder’s visual mode, click the blue “+” to display available modules. Also other FacetWP features can be placed with shortcodes. Nov 15, 2023 · echo facetwp_display( 'facet', 'my_facet_name' ); // Or echo do_shortcode('[facetwp facet="my_facet_name"]'); The trick to get this working is to add the facet/listing as follows. Sep 10, 2024 · Scroll on facet interaction after the initial page load. Facet type: Select checkboxes (or any of the nine options depending on the facet). Without it, facets will not show up. For any facet to work, there needs to be a FacetWP-enabled listing on the page. The settings let you sync user data to the new post type so it can be used when setting up facets that can filter users. The Caching add-on can help speed up high-traffic pages with commonly used facet combinations because it prevents FacetWP from having to calculate the choices for each facet on each page load. Setup. My Account Support Sales About Us May 3, 2024 · Tip 1: If you want to disable FacetWP’s auto-refresh and use a submit/apply/filter button instead to filter the results on the same page, you don’t need this add-on. If you want to customize the facet’s container/placeholder element, for example to add a custom class or attribute, use the facetwp_shortcode_html hook instead. This keeps the index up to date automatically without having to worry about it, and without putting the potentially heavy burden of a full re-index on your site. php file. php: Jan 24, 2022 · FacetWP adds advanced filtering – i. Aug 19, 2024 · How character matching works. Overview. If you have a facet based on a taxonomy or custom (text) field, you can use the facetwp_facet_display_value hook to change the facet’s choices into images, using the term or field value in the image file name. However, it requires the use of a custom field containing the longitude and latitude previously filled in; Radio: radio buttons to tick; Star rating: filtering by number of stars; Pager: a facet of pagination ; Data Source: the sorting criterion on which the Sep 12, 2022 · Navigate to the FacetWP Admin Page > Add Facet. If you are using Elementor, you can also use the FacetWP facet widget and listing widget to do With the Custom Permalinks for WooCommerce plugin by Meow Crew, you can customize the permalinks for your WooCommerce product pages and product category archives. If you are using a Pager facet, this hooks lets you manipulate the paging data that the Pager uses to display itself: the currently displayed page, the number of posts per_page, the total_rows (total number of posts) and the total_pages (total number of pages). e. php. Creating a custom field. Sep 10, 2024 · Posts without the custom field will be sorted by post title and added after the ones with the custom field: How to use custom PHP code? PHP code can be added to your (child) theme's functions. The /facetwp/v1/fetch endpoint lets you query raw FacetWP data, with which you can build custom applications. See this explanation of how the indexing process works and which/how facet data is stored in the facetwp_index table. Activate in wp-config. What gets searched and how? By default, Search facets use WordPress core search. FacetWP has an automatic indexer that performs a single re-index when an individual item (a post, page, and category or term name/slug) is edited or saved. FacetWP includes many facet types, including checkboxes, dropdowns, date ranges, sliders, pagers, and even proximity (geolocation). GitHub Gist: instantly share code, notes, and snippets. Jun 4, 2024 · Most of the PHP-based code examples in our Help Center articles and our custom code library are based on WordPress or FacetWP hooks, which can be pasted directly into your (child) theme’s functions. Or, for facets using a custom field created with Advanced Custom Fields , use the ACF Multilingual plugin . Nov 22, 2024 · Also, make sure that any custom code using the facetwp_index_row hook is correct, or remove it temporarily to test (make sure to re-index after doing so). May 2, 2023 · If you are using the Custom Taxonomy Order plugin to order your taxonomy terms, use the code below to preserve that order for facets that use terms. Sep 6, 2024 · With the help of Meta Box, you can create any kind of data (custom fields) for your product / listing or any custom post type. Aug 26, 2020 · Proximity: a facet that allows you to search for results around a specific location. Usage. For WPML see this tutorial . FacetWP works great with WooCommerce, Advanced Custom Fields, and many other WordPress plugins. We can see your payment ID in the ticket and can retrieve your email address. However, when you have other facets on the page besides a Search facet, you’ll need to also force FacetWP to index attachments . FacetWP Button – adds an Apply button, a Flyout button or a Submit button. Nov 25, 2024 · FacetWP and its index table are highly optimized to handle large amounts of content. Setting facet_value to the custom field value FacetWP comes with its own set of shortcodes. The above code sets both the facet_display_value and the facet_value to the custom field's value while indexing. php or functions. By default, the A-Z Listing facet will only show the capital letters A to Z in the standard Latin alphabet. Improve indexing speed Nov 22, 2024 · FacetWP has two API endpoints: the /facetwp/v1/fetch and the /facetwp/v1/refresh endpoint. A basic loop example using the above custom query would look like this: 4 days ago · FacetWP Facet – adds a facet. FacetWP Listing – adds a Listing Builder listing. May 28, 2024 · Note: This hook only has access to the HTML of a facet’s content. Sep 11, 2024 · • We introduced a new `facetwp_scripts` action hook which you can use to add custom scripts that only run on pages with facets (as opposed to using the `wp_footer` hook which runs on every page). Another option is to create an image facet based on an Advanced Custom Fields Image field type, using the selected images directly. Check out this tutorial for instructi Nov 22, 2024 · For extra filtering speed you can enable FacetWP’s Caching add-on, which caches FacetWP’s own AJAX requests in the database. May 21, 2024 · FacetWP provides many different UI elements (also called facet types) to allow your site visitors to narrow down the posts in your listing template. Show your results. But there are limits to servers, the database, and MySQL itself to take into account. Oct 29, 2024 · [facetwp facet="keywords"] [facetwp template="site_search"] [facetwp facet="pager_numbers"] If you want to use another type of listing template than a Listing Builder listing, you can just add the two facet shortcodes to the template. Jul 4, 2024 · For FacetWP to work with this custom query, the facetwp => true argument needs to be added. See also Indexing; The Custom Hooks add-on; Using FacetWP with WP Engine; Using FacetWP with WPML or Polylang; Using FacetWP with Advanced Custom Fields; The facetwp_indexer_query_args hook Nov 21, 2024 · Your site deserves the best filtering. This update contains the following improvements, new features and bug fixes: Export all facets and/or listings for export. This filter is useful for adding custom data sources, or for modifying the existing ones. See all facet types. ) are available as modules too. The query argument array is the input for the query: it tells WordPress which posts to retrieve from the database, in which order, how many per page, etc. For more flexibility, you can use FacetWP’s SearchWP or Relevanssi integration. Jan 16, 2024 · If you are using the Intuitive Custom Post Order plugin to order your taxonomy terms, use the code below to preserve that order for facets that use terms. Long text, text that’s relatively unique (such as SKUs or street names), dates, and numeric values are usually stored as custom fields. Within that area, you’ll see a new “FacetWP” section. 2 days ago · Name Description; Data source: Where the values live (taxonomy, custom field, post attribute). Because the facetwp-loaded event fires after each AJAX page load, the page will scroll when any facet is used. 4 was released on November 21, 2024. . After installing, you’ll see a new header in the “Data source” dropdown when editing your facet. For searching in short data items only, you could consider using an Autocomplete facet instead. How to paste a facet or listing shortcode into a WP Shortcode block. Or – if you use a separate custom field for the longitude – only a latitude. The following example scrolls the page to the top of the results (the element with class facetwp-template), after each facet interaction. : Default label Nov 25, 2024 · Create your facets Setting a WooCommerce field as a facet’s data source. Developer friendly Developers can take advantage of the plugin's many hooks for a high degree of customization. Create the query loop. My Account Support Sales About Us Sep 10, 2024 · Custom fields do not include built-in listing URLs, but you can both filter and sort by custom fields (unlike with taxonomies). Sep 10, 2024 · [facetwp facet="single_map"] [facetwp template="single_page"] Add these shortcodes directly in the page’s content field, or use a Shortcode block (when using the Block Editor), or a Shortcode widget (when using Elementor, Bricks or Beaver Builder). Outputs custom scripts or CSS for front-facing facet pages: register_fields (optional) Add custom settings fields: Nov 22, 2024 · Term slugs are stored in FacetWP’s index table as facet_value and are used for filtering, which also means they will show up as facet slug in the URL after interacting with the facet. Nov 22, 2024 · FacetWP does not index anything for Search facets, so if you only have a Search facet on your page, this is enough to enable searching within attachments/PDFs. May 3, 2024 · Tip 1: If you want to disable FacetWP’s auto-refresh and use a submit/apply/filter button instead to filter the results on the same page, you don’t need this add-on. With a “FacetWP Facet” widget you can add an existing facet to your Elementor page. Each facet and Listing Builder listing you create, gets its own [facetwp] shortcode that outputs the facet or listing. The /facetwp/v1/refresh endpoint is used by FacetWP itself in the front-end, for filtering. Select the “Facet” option, then choose an existing facet: Other FacetWP features (Sort, Selections, etc. The first letter of each post is compared to these letters, after being stripped from any accent (or simplified) with WP’s built-in remove_accents() function, before being indexed. Dec 15, 2023 · Note: Unlike other facet types, the User Selections facet does not appear in FacetWP’s admin UI, and does not have any settings. Without a valid listing template, facets will not show up. 3. May 24, 2024 · You can create your own facet types with FacetWP. Label: The name of your facet. This add-on integrates FacetWP with WP Recipe Maker or Tasty Recipes. Make sure to keep the existing class of the facet (that contains its name, after facetwp-facet-). With this hook you can change the raw WP_Query arguments before the query is executed, and before facets are processed in the rendering process. When calculating the time intervals, the Time Since add-on honors the timezone you have set on the WordPress General Settings page. Nov 28, 2024 · Using FacetWP with Advanced Custom Fields; The facetwp_render_output hook; The Number Range facet type; The Range List facet type; Using the facetwp_i18n hook to translate facet labels and strings; How to disable facet auto-refresh and add a submit button Oct 22, 2024 · To activate the plugin, browse to Settings > FacetWP > Settings > General, fill in the “License key” field, then click the “Activate” button. Nov 25, 2024 · When importing products with the WP All Import plugin (or the free version) , FacetWP’s automatic indexer is triggered. php : Nov 22, 2024 · If your facet uses a custom field as data source, just translate that custom field. Shortcodes often have attributes. Some facet types are built-in, others you have to install as add-on plugins . Nov 22, 2024 · Your site deserves the best filtering. For example, FacetWP shortcodes for facets have a facet attribute that contains the FacetWP Bootstrap 4 Custom Facet Type. Jul 3, 2024 · Overview. Nov 22, 2024 · FacetWP 4. Dec 3, 2024 · It is possible to pre-select facet choices on page load, using the facetwp_preload_url_vars hook. faceted search – to your result listings. To add the User Selections facet to your page, add the following shortcode to an HTML or text widget (in Appearance > Widgets), or to a HTML block Apr 21, 2022 · Your site deserves the best filtering. This happens because posts and/or terms are being inserted and/or saved during the import process. pscnv voa gkhbm rxoyi pgx ghiaqfl qtxl anhhig zmvht vzacr