Add README.md
This commit is contained in:
parent
197b17896b
commit
f9ebbe47d3
211
README.md
Normal file
211
README.md
Normal file
@ -0,0 +1,211 @@
|
||||
# Shoptimizer Brand Filter Widget
|
||||
|
||||
A custom WordPress plugin that adds brand/family filtering functionality to WooCommerce archive pages in the Shoptimizer theme.
|
||||
|
||||
## Features
|
||||
|
||||
- **Shortcode Support**: Use `[shoptimizer_brand_filter]` anywhere
|
||||
- **Widget Support**: Add via WordPress admin widgets area
|
||||
- **Archive Page Integration**: Works on shop, category, tag, and taxonomy pages
|
||||
- **Customizable Options**: Title, product counts, ordering, limits
|
||||
- **Mobile Responsive**: Optimized for all device sizes
|
||||
- **Theme Integration**: Styled to match Shoptimizer theme
|
||||
- **Update Safe**: Standalone plugin won't be affected by theme updates
|
||||
|
||||
## Installation
|
||||
|
||||
1. **Upload Files**: Copy the plugin files to your WordPress installation:
|
||||
```
|
||||
/wp-content/plugins/shoptimizer-brand-filter/
|
||||
├── shoptimizer-brand-filter.php
|
||||
├── assets/
|
||||
│ └── brand-filter.css
|
||||
└── README-Brand-Filter.md
|
||||
```
|
||||
|
||||
2. **Activate Plugin**: Go to WordPress admin > Plugins > Activate "Shoptimizer Brand Filter Widget"
|
||||
|
||||
3. **Verify Brand Taxonomy**: Ensure your WooCommerce store uses the `product_brand` taxonomy for brands
|
||||
|
||||
## Usage
|
||||
|
||||
### Method 1: Shortcode
|
||||
|
||||
Add the shortcode to any page, post, or widget:
|
||||
|
||||
```php
|
||||
[shoptimizer_brand_filter]
|
||||
```
|
||||
|
||||
#### Shortcode Attributes
|
||||
|
||||
```php
|
||||
[shoptimizer_brand_filter
|
||||
title="Filter by Brand"
|
||||
show_count="yes"
|
||||
hide_empty="yes"
|
||||
orderby="name"
|
||||
order="ASC"
|
||||
limit="0"
|
||||
show_all_option="yes"
|
||||
]
|
||||
```
|
||||
|
||||
**Available Attributes:**
|
||||
- `title` - Widget title (default: "Filter by Brand")
|
||||
- `show_count` - Show product count (yes/no, default: yes)
|
||||
- `hide_empty` - Hide brands with no products (yes/no, default: yes)
|
||||
- `orderby` - Sort by name, count, or term_id (default: name)
|
||||
- `order` - ASC or DESC (default: ASC)
|
||||
- `limit` - Maximum brands to show (0 = no limit)
|
||||
- `show_all_option` - Show "All Brands" link (yes/no, default: yes)
|
||||
|
||||
### Method 2: Widget
|
||||
|
||||
1. Go to **Appearance > Widgets**
|
||||
2. Add "Shoptimizer Brand Filter" widget to your sidebar
|
||||
3. Configure the widget settings
|
||||
4. Save changes
|
||||
|
||||
### Method 3: Template Integration
|
||||
|
||||
Add directly to your theme templates:
|
||||
|
||||
```php
|
||||
<?php echo do_shortcode('[shoptimizer_brand_filter]'); ?>
|
||||
```
|
||||
|
||||
## Sidebar Integration
|
||||
|
||||
For WooCommerce archive pages, add the widget to your sidebar:
|
||||
|
||||
1. **WordPress Admin** > **Appearance** > **Widgets**
|
||||
2. Drag **Shoptimizer Brand Filter** to **Sidebar** area
|
||||
3. Configure settings:
|
||||
- Title: "Shop by Brand"
|
||||
- Show product counts: ✓
|
||||
- Hide empty brands: ✓
|
||||
- Order by: Name
|
||||
- Order: Ascending
|
||||
|
||||
## Styling
|
||||
|
||||
The plugin includes comprehensive CSS that matches the Shoptimizer theme. Key classes:
|
||||
|
||||
```css
|
||||
.shoptimizer-brand-filter /* Main container */
|
||||
.widget-title /* Widget title */
|
||||
.product-brands /* Brand list */
|
||||
.brand-item /* Individual brand */
|
||||
.current-brand /* Active/selected brand */
|
||||
.all-brands /* "All Brands" option */
|
||||
.count /* Product count */
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
### Custom CSS
|
||||
|
||||
Add custom styles in **Appearance > Customize > Additional CSS**:
|
||||
|
||||
```css
|
||||
.shoptimizer-brand-filter .widget-title {
|
||||
color: #your-color;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.shoptimizer-brand-filter .brand-item a:hover {
|
||||
background-color: #your-hover-color;
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Functions
|
||||
|
||||
Override plugin behavior in your child theme's `functions.php`:
|
||||
|
||||
```php
|
||||
// Custom brand query args
|
||||
add_filter('shoptimizer_brand_filter_args', function($args) {
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'featured_brand',
|
||||
'value' => 'yes',
|
||||
'compare' => '='
|
||||
)
|
||||
);
|
||||
return $args;
|
||||
});
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- **WordPress**: 5.0 or higher
|
||||
- **WooCommerce**: 4.0 or higher
|
||||
- **Theme**: Shoptimizer (recommended)
|
||||
- **PHP**: 7.4 or higher
|
||||
- **Taxonomy**: `product_brand` must exist
|
||||
|
||||
## Brand Taxonomy Setup
|
||||
|
||||
If you don't have the `product_brand` taxonomy, you can:
|
||||
|
||||
1. **Use a plugin** like "Brands for WooCommerce"
|
||||
2. **Create manually** with this code in functions.php:
|
||||
|
||||
```php
|
||||
add_action('init', function() {
|
||||
register_taxonomy('product_brand', 'product', array(
|
||||
'label' => 'Brands',
|
||||
'hierarchical' => true,
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_nav_menus' => true,
|
||||
'show_tagcloud' => false,
|
||||
));
|
||||
});
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Widget Not Showing
|
||||
|
||||
1. Check if WooCommerce is active
|
||||
2. Verify you're on a WooCommerce archive page
|
||||
3. Ensure `product_brand` taxonomy exists
|
||||
4. Check if there are any brands with products
|
||||
|
||||
### Styling Issues
|
||||
|
||||
1. Clear caching plugins
|
||||
2. Check for CSS conflicts
|
||||
3. Verify theme compatibility
|
||||
4. Try disabling other plugins temporarily
|
||||
|
||||
### No Brands Appearing
|
||||
|
||||
1. Go to **Products > Brands** in WordPress admin
|
||||
2. Add/assign brands to products
|
||||
3. Ensure "Hide empty brands" is disabled for testing
|
||||
|
||||
## Changelog
|
||||
|
||||
### Version 1.0.0
|
||||
- Initial release
|
||||
- Shortcode and widget support
|
||||
- Mobile responsive design
|
||||
- Shoptimizer theme integration
|
||||
- Multiple customization options
|
||||
|
||||
## Support
|
||||
|
||||
For support with this plugin:
|
||||
|
||||
1. Check the troubleshooting section
|
||||
2. Verify your setup meets requirements
|
||||
3. Test with default theme/plugins disabled
|
||||
4. Contact your developer for custom modifications
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under GPL v2 or later license.
|
||||
Loading…
x
Reference in New Issue
Block a user