Below, you’ll find a detailed guide on how to add the Beautiful taxonomy filters Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Beautiful taxonomy filters Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Beautiful taxonomy filters Plugin and the shortcodes it provides:
"Beautiful Taxonomy Filters is a powerful WordPress plugin that enhances your website's functionality by enabling dynamic and aesthetic filtering based on custom taxonomies."
- [show_beautiful_filters]
- [show_beautiful_filters_info]
Beautiful taxonomy filters [show_beautiful_filters] Shortcode
The Beautiful Taxonomy Filters shortcode is a dynamic tool in WordPress that allows users to filter posts by taxonomy. The shortcode accepts a ‘post_type’ attribute, which specifies the type of posts to filter. If no ‘post_type’ is provided, it will not filter the posts. The shortcode returns a list of posts filtered according to the specified ‘post_type’.
Shortcode: [show_beautiful_filters]
Parameters
Here is a list of all possible show_beautiful_filters shortcode parameters and attributes:
post_type
– specifies the type of post to apply the filters to
Examples and Usage
Basic example – Showcases the application of the ‘show_beautiful_filters’ shortcode without specifying any post type. It will apply the filters to all the posts by default.
[show_beautiful_filters]
Advanced examples
Displaying filters for a specific post type. In this example, the shortcode is configured to only show the filters for ‘product’ post type.
[show_beautiful_filters post_type='product']
Displaying filters for multiple post types. Here, the shortcode is set to show the filters for both ‘product’ and ‘service’ post types.
[show_beautiful_filters post_type='product,service']
PHP Function Code
In case you have difficulties debugging what causing issues with [show_beautiful_filters]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'show_beautiful_filters', array( $this, 'shortcode_beautiful_filters' ) );
Shortcode PHP function:
function shortcode_beautiful_filters( $attributes ) {
$attributes = shortcode_atts(
array(
'post_type' => false,
),
$attributes,
'show_beautiful_filters'
);
return Beautiful_Taxonomy_Filters_Public::beautiful_filters( $attributes['post_type'], array( 'echo' => false ) );
}
Code file location:
beautiful-taxonomy-filters/beautiful-taxonomy-filters/public/class-beautiful-taxonomy-filters-shortcodes.php
Beautiful taxonomy filters [show_beautiful_filters_info] Shortcode
The Beautiful Taxonomy Filters plugin shortcode, ‘show_beautiful_filters_info’, is designed to display filter information on your website. This PHP function calls the ‘beautiful_filters_info’ method from the ‘Beautiful_Taxonomy_Filters_Public’ class, returning the filter data.
Shortcode: [show_beautiful_filters_info]
Examples and Usage
Basic example – Show Beautiful Filters Info
[show_beautiful_filters_info]
This shortcode will display the information about the Beautiful Filters applied. Since the shortcode doesn’t require any parameters, it can be used as is.
PHP Function Code
In case you have difficulties debugging what causing issues with [show_beautiful_filters_info]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'show_beautiful_filters_info', array( $this, 'shortcode_beautiful_filters_info' ) );
Shortcode PHP function:
function shortcode_beautiful_filters_info() {
return Beautiful_Taxonomy_Filters_Public::beautiful_filters_info();
}
Code file location:
beautiful-taxonomy-filters/beautiful-taxonomy-filters/public/class-beautiful-taxonomy-filters-shortcodes.php
Conclusion
Now that you’ve learned how to embed the Beautiful taxonomy filters Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply