Description
This filter allows you to modify the attributes on the store thumbnail.
The default attributes that are set are the alt text, which is the store name, and a wpsl-store-thumb class.
The thumbnail is the featured image of the store. It’s only included in the search results when the store has one.
Parameters
$attr - (array) The current thumbnail attributes. By default array( 'class' => 'wpsl-store-thumb', 'alt' => $store_name ).
Usage
This example adds a custom-style class to the thumbnail class attributes:
| add_filter( 'wpsl_thumb_attr', 'custom_thumb_attr' ); | |
| function custom_thumb_attr( $attr ) { | |
| $attr['class'] = 'wpsl-store-thumb custom-style'; | |
| return $attr; | |
| } |
Keep the wpsl-store-thumb class when you change the class attribute. The plugin CSS and the thumbnail size from wpsl_thumb_size use it.
The attributes are passed to the WordPress get_the_post_thumbnail() function, which adds the wp-post-image class itself.
If Load locations on page load is on, the locations shown on page load can come from a cache. After you add the filter, go to Store Locator > Settings > Tools and click Clear cache next to Autoload cache.
Changelog
| Version | Description |
|---|---|
| 3.0 | Moved to includes/frontend/store/class-data.php. |
| 2.0 | Introduced. |
Source File
This filter is located in /includes/frontend/store/class-data.php.
Placement
The code needs to be placed in the functions.php file inside your active theme folder.