# Contributing to Advanced Widget Kit

Thank you for considering contributing to Advanced Widget Kit! We welcome contributions from the community and are pleased to have you aboard.

## 🤝 How to Contribute

### 🐛 Reporting Bugs

Before creating a bug report, please check the existing issues to see if the problem has already been reported. When creating a bug report, please include:

- **Clear title** - Summarize the problem in the title
- **WordPress version** - Which version are you using?
- **Elementor version** - Free or Pro, and version number
- **PHP version** - Check in WordPress Site Health
- **Plugin version** - Which version of Advanced Widget Kit
- **Steps to reproduce** - Detailed steps to reproduce the issue
- **Expected behavior** - What you expected to happen
- **Actual behavior** - What actually happened
- **Screenshots** - If applicable, add screenshots
- **Browser/Device** - Which browser and device you're using

### 💡 Suggesting Features

We love feature suggestions! Please:

- **Check existing issues** - Make sure it hasn't been suggested already
- **Describe the feature** - What should it do?
- **Explain the use case** - Why would this be useful?
- **Consider the scope** - Should this be in free or pro version?

### 🔧 Code Contributions

#### Getting Started

1. **Fork the repository** on GitHub
2. **Clone your fork** locally:
   ```bash
   git clone https://github.com/YOUR-USERNAME/Free-advanced-widget-kit.git
   cd Free-advanced-widget-kit
   ```

3. **Create a branch** for your feature:
   ```bash
   git checkout -b feature/your-feature-name
   ```

#### Development Guidelines

##### WordPress Coding Standards
- Follow [WordPress PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/)
- Use proper WordPress functions and hooks
- Sanitize all user inputs
- Escape all outputs
- Use WordPress nonces for security

##### Plugin Structure
```php
<?php
// Always start with this
if (!defined('ABSPATH')) {
    exit;
}

class Your_Class_Name {
    // Use proper class structure
}
```

##### Widget Development
- Extend `\Elementor\Widget_Base`
- Follow Elementor widget development guidelines
- Use proper control types and groups
- Include proper translations (`esc_html__()`)
- Add frontend and editor styles/scripts only when needed

##### CSS Guidelines
- Use consistent naming conventions (BEM methodology preferred)
- Mobile-first responsive design
- Use CSS custom properties when beneficial
- Optimize for performance

##### JavaScript Guidelines
- Use vanilla JavaScript or jQuery (already available)
- Follow WordPress JavaScript coding standards
- Use proper event handling and cleanup
- Ensure accessibility (ARIA labels, keyboard navigation)

#### Testing

Before submitting your contribution:

- **Test with multiple WordPress versions** (5.0+)
- **Test with Elementor Free and Pro**
- **Test on different devices** and browsers
- **Check for PHP errors** and warnings
- **Verify accessibility** features work
- **Test with common themes**

#### Submitting Changes

1. **Commit your changes**:
   ```bash
   git add .
   git commit -m "Add feature: your feature description"
   ```

2. **Push to your fork**:
   ```bash
   git push origin feature/your-feature-name
   ```

3. **Create a Pull Request**:
   - Go to the original repository on GitHub
   - Click "New Pull Request"
   - Select your branch
   - Fill out the PR template

#### Pull Request Guidelines

- **Clear title** - Describe what the PR does
- **Detailed description** - Explain the changes and why
- **Link related issues** - Reference any related issues
- **Screenshots** - If UI changes, include before/after
- **Testing notes** - How you tested the changes
- **Breaking changes** - Note any breaking changes

## 📝 Code Style

### PHP Code Style

```php
<?php
/**
 * Class description
 *
 * @package Advanced_Widget_Kit
 * @since 1.0.0
 */
class AWKE_Example_Class {

    /**
     * Method description
     *
     * @since 1.0.0
     * @access public
     * @param string $param Parameter description
     * @return bool Return description
     */
    public function example_method($param) {
        // Use proper spacing and indentation
        if (!empty($param)) {
            return true;
        }
        
        return false;
    }
}
```

### CSS Code Style

```css
/* Use consistent formatting */
.AWKE-widget-example {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.AWKE-widget-example:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Mobile first responsive */
@media (max-width: 768px) {
    .AWKE-widget-example {
        padding: 15px;
    }
}
```

### JavaScript Code Style

```javascript
(function($) {
    'use strict';

    var AWKE_Example = {
        
        init: function() {
            this.bindEvents();
        },

        bindEvents: function() {
            $('.AWKE-example').on('click', this.handleClick.bind(this));
        },

        handleClick: function(e) {
            e.preventDefault();
            // Handle click event
        }
    };

    // Initialize when document is ready
    $(document).ready(function() {
        AWKE_Example.init();
    });

})(jQuery);
```

## 🏗️ Development Environment

### Local Setup

1. **WordPress Development Environment**:
   - Use Local by Flywheel, XAMPP, or Docker
   - WordPress 5.0+ with Elementor installed

2. **Code Editor**:
   - VS Code with WordPress and PHP extensions
   - Or any editor with PHP syntax highlighting

3. **Testing Tools**:
   - Browser developer tools
   - WordPress debug mode enabled
   - Query Monitor plugin for debugging

### Useful Commands

```bash
# Clone the repository
git clone https://github.com/ainixit/Free-advanced-widget-kit.git

# Create a new feature branch
git checkout -b feature/new-widget

# Check for PHP syntax errors
php -l filename.php

# Format code (if using PHP CS Fixer)
php-cs-fixer fix --config=.php_cs.dist
```

## 📋 Issue Labels

We use these labels to organize issues:

- **bug** - Something isn't working
- **enhancement** - New feature or request
- **good first issue** - Good for newcomers
- **help wanted** - Extra attention is needed
- **question** - Further information is requested
- **wontfix** - This will not be worked on
- **duplicate** - This issue or PR already exists

## 🎯 Priority Guidelines

### High Priority
- Security vulnerabilities
- Critical bugs affecting core functionality
- Compatibility issues with WordPress/Elementor updates

### Medium Priority
- Feature requests with broad appeal
- Performance improvements
- UI/UX enhancements

### Low Priority
- Minor bugs with workarounds
- Nice-to-have features
- Code refactoring

## 📞 Getting Help

If you need help with contributing:

- **Documentation**: Check the [plugin documentation](https://awk.ainixit.com/docs/advanced-widget-kit)
- **Issues**: Look through existing GitHub issues
- **Contact**: Reach out to the maintainers

## 🙏 Recognition

Contributors will be:
- Listed in the plugin credits
- Mentioned in release notes
- Given a contributor badge (if applicable)

## 📄 License

By contributing to Advanced Widget Kit, you agree that your contributions will be licensed under the same GPL v2 or later license that covers the project.

---

**Thank you for contributing to Advanced Widget Kit! 🚀**
