Skip to main content

Welcome Contributors

Thank you for your interest in contributing to Visual Portfolio! This guide will help you get started with the development workflow and contribution process.

Prerequisites

Before you begin, ensure you have the following installed:
  • PHP >= 7.2
  • Node.js >= 18.0
  • Composer >= 2.0
  • Docker (for running tests)
  • Git for version control

Getting Started

1. Fork and Clone

Fork the Visual Portfolio repository and clone it to your local machine:

2. Install Dependencies

Install both Node.js and PHP dependencies:
This command will automatically run composer install as a postinstall hook to set up PHP dependencies.

3. Start Development

Start the development server with hot reloading:
This command runs webpack in watch mode with hot module replacement enabled.

Development Workflow

Building Assets

Never run npm run build:prod during regular development. This command is only for creating production releases. Always use npm run dev or npm run build instead.

Code Quality Checks

Before committing your changes, ensure your code passes all quality checks. The project uses automated pre-commit and pre-push hooks powered by Husky and lint-staged.
Learn more about code quality standards in the Code Quality guide.

Running Tests

Always run tests before submitting a pull request:
See the Testing guide for detailed information about writing and running tests.

WordPress Environment

The plugin uses @wordpress/env for local WordPress development:
Once started, access your local WordPress site at http://localhost:8889.

Contribution Guidelines

Code Standards

  • PHP: Follow WordPress Coding Standards (WPCS)
  • JavaScript: Use ESLint with WordPress configuration
  • CSS/SCSS: Follow Stylelint rules with WordPress SCSS config
  • Commits: Write clear, descriptive commit messages

Security Best Practices

Always follow WordPress security guidelines:

Naming Conventions

  • PHP Classes: Visual_Portfolio_* prefix
  • Functions: vpf_* prefix
  • Hooks: Use WordPress action/filter system
  • Text Domain: visual-portfolio

Pull Request Process

  1. Create a Branch: Use descriptive branch names (e.g., feature/add-masonry-layout, fix/image-loading-bug)
  2. Make Changes: Follow the code standards and write tests
  3. Run Quality Checks: Ensure all linting and tests pass
  4. Commit Changes: Write clear commit messages
  5. Push to Fork: Push your changes to your forked repository
  6. Open Pull Request: Submit a PR with a detailed description of your changes

Pull Request Checklist

Before submitting a pull request, verify:
  • Code follows WordPress Coding Standards
  • All linting checks pass (npm run lint)
  • All tests pass (npm test)
  • Code is properly documented with PHPDoc/JSDoc
  • Security best practices are followed
  • Translations are properly implemented
  • Changes are backward compatible (or clearly documented)
  • Pull request description explains the changes and their purpose

File Structure

Understanding the plugin structure helps you navigate the codebase:

Version Management

The plugin uses Gulp for version bumping:
Version bumping is typically handled by maintainers during the release process.

Translation

The plugin is translation-ready. To generate translation files:
All translatable strings should use the visual-portfolio text domain:

Getting Help

License

By contributing to Visual Portfolio, you agree that your contributions will be licensed under the GPL-2.0 License.