Documentation / Functions

Functions

Here are basic API functions and hooks, that currently supported by Filter Everything plugin.

Notice: always use these functions with wrapper, that checks their availability to prevent errors, when plugin will be disabled.

Example:

if( function_exists( 'flrt_get_page_related_filters' ) ){
    // Do something
    flrt_get_page_related_filters();
}

Page Related Filters

/**
 * @return array of all filters from the Filter Set
 * related with current page
 * or empty array if there are no filters
 */
flrt_get_page_related_filters();

 

Selected Filters Terms

Note: this function works correctly only if it fires after the Main WP_Query.
It means after hook ‘pre_get_posts’ fired.

/**
 * @return array|false all selected filters or false
 */
flrt_selected_filter_terms();

 

Selected Filters Chips

/**
 * @param bool $include_reset - include Reset button term or not
 * @return array|false - selected terms
 */
flrt_selected_filter_chips( $include_reset = false )

 

Number of filtered posts

/**
 * @return int|null number of posts found
 */
flrt_posts_found_quantity( $filter_set_id )

 

Page SEO data

/**
 * @param string $key possible values are title|description|h1|text
 * @return string|false Needed seo data
 */
flrt_get_seo_data( $key = 'title' );

 

Display chips

/**
 * @param bool $showReset whether to show or not the Reset button 
 */ 
flrt_chips( $showReset = false );

Usage example:

<?php 
// Place this code in your theme file, 
// where you need to show chips (selected Filters terms)
if( function_exists('flrt_chips') ){
    flrt_chips(true);
} ?>

 

Check if is filtered page

/**
 * @return bool true if it is filtered page and false if not
 */ 
flrt_is_filter_request();

Usage example:

<?php 
if( flrt_is_filter_request() ){
    // Your useful code
} ?>

Make your filtering best with