Skip to content

Unofficial PHP coding standards for WordPress theme and plugins sold on ThemeForest and CodeCanyon

Notifications You must be signed in to change notification settings

wpsh/wpcs-for-envato

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Standard for WordPress Plugins and Themes on Envato Market

Build Status

Automatically check for Envato WordPress plugin and theme coding requirements. Based on the official WordPress coding standards but more relaxed.

Requirements

Setup

  1. Add these coding standards as a Composer development dependency to your project:

    composer require --dev wpsh/wpcs-for-envato
  2. Define a script in composer.json to run the checks:

    {
    	"scripts": {
    		"phpcs": "./vendor/bin/phpcs --standard=WPCSForEnvato --extensions=php",
    		"phpcs-fix": "./vendor/bin/phpcbf --standard=WPCSForEnvato --extensions=php"
    	}
    }

    Use composer phpcs to run the coding standard checks and composer phpcs-fix to automatically fix some of the coding standard violations.

Configuration

Add phpcs.xml.dist to your project root that provides additional configuration options:

<?xml version="1.0"?>
<ruleset name="WordPress coding standards for Envato">
	<rule ref="WPCSForEnvato"/>

	<!-- Specify a prefix that should be used for all global functions and variables. -->
	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
		<properties>
			<property name="prefixes" type="array">
				<element value="our_custom_prefix"/>
				<element value="tgmpa"/>
			</property>
		</properties>
	</rule>
</ruleset>

Credits

Created by Kaspars Dambis.