Facet methods
This method allows to initialize facets script. It’s mainly used if you destroy()
the instance. Otherwise, there isn’t any reason to init()
facets since it’s automatically done by the plugin on load.
[pastacode lang=”javascript” manual=”wpgb.facets.init()%3B” message=”” highlight=”” provider=”manual”/]
You can destroy facets instance at any time thanks to this method.
[pastacode lang=”javascript” manual=”wpgb.facets.destroy()%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to refresh facets and grid content. It can be useful if you programmatically change facets parameters thanks to setParams()
or deleteParams()
methods.
[pastacode lang=”javascript” manual=”wpgb.facets.refresh()%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to abort an asynchronous task like refresh()
method. It prevents making several requests at the same time which can lead to wrong results.
[pastacode lang=”javascript” manual=”wpgb.facets.abort()%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to modify browser history and url. It is generally used after modifying facets parameters thanks to setParams()
or deleteParams()
methods and before to refresh()
content.
[pastacode lang=”javascript” manual=”wpgb.facets.pushState()%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to modify browser history and url. It is generally used after modifying facets parameters thanks to setParams()
or deleteParams()
methods and before to refresh()
content.
Argument | Type | Description |
facets | null|array | Hold facet slug(s) to reset |
[pastacode lang=”javascript” manual=”%2F%2F%20Reset%20all%20facets.%0Awpgb.facets.reset()%3B%0A%2F%2F%20Reset%20specific%20facets%0A.wpgb.facets.reset(%20%5B’facet_slug_1’%2C%20’facet_slug_2’%5D%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to get facet(s) properties.
Argument | Type | Description |
facet | integer|string | Facet id or slug |
[pastacode lang=”javascript” manual=”%2F%2F%20Get%20specific%20facet%20by%20its%20id.%0Awpgb.facets.getFacet(%201%20)%3B%0A%2F%2F%20Get%20specific%20facet%20by%20its%20slug.%0Awpgb.facets.getFacet(%20’facet_slug’%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to check if a facet exists.
Argument | Type | Description |
facet | integer|string | Facet id or slug |
[pastacode lang=”javascript” manual=”%2F%2F%20Check%20if%20facet%20exists%20by%20its%20id.%0Awpgb.facets.hasFacet(%201%20)%3B%0A%2F%2F%20Check%20if%20facet%20exists%20by%20its%20slug.%0Awpgb.facets.hasFacet(%20’facet_slug’%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to get parameters (selected values) of a facet.
Argument | Type | Description |
facet | string | Facet slug |
[pastacode lang=”javascript” manual=”wpgb.facets.getParams(%20’facet_slug’%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to check if a facet has parameters (selected values).
Argument | Type | Description |
facet | string | Facet slug |
[pastacode lang=”javascript” manual=”wpgb.facets.hasParams(%20’facet_slug’%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to assign parameters (selected values) to a facet.
Argument | Type | Description |
facet | string | Facet slug |
params | array | Holds facet parameters as string |
[pastacode lang=”javascript” manual=”wpgb.facets.setParams(%20’facet_slug’%2C%20%5B’param1’%2C%20’param2’%5D%20)%3B” message=”” highlight=”” provider=”manual”/]
This methods allows to delete parameters (selected values) from a facet.
Argument | Type | Description |
facet | string | Facet slug |
params | array | Holds facet parameters as string |
[pastacode lang=”javascript” manual=”wpgb.facets.deleteParams(%20’facet_slug’%2C%20%5B’param1’%5D%20)%3B” message=”” highlight=”” provider=”manual”/]