Preparing for WCEU 2019 contributor day

What is the contributor dayContributor Day Contributor Days are standalone days, frequently held before or after WordCamps but they can also happen at any time. They are events where people get together to work on various areas of https://make.wordpress.org/ There are many teams that people can participate in, each with a different focus. https://2017.us.wordcamp.org/contributor-day/ https://make.wordpress.org/support/handbook/getting-started/getting-started-at-a-contributor-day/.?

As noted on the official contributor day registration page, contributor day is a one-day event where volunteers contribute to WordPress, collaborate with new and existing contributors, and learn about the different ways to get involved in the project. Events like this take place all over the world, either as standalone fixtures or partnered with a WordCampWordCamp WordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what they’ve learned throughout the year and share the joy. Learn more..

This year it’s held on 20th of June before the main conference. The Theme Review team (TRT) will be lead by Denis Žoljom aka @dingo_d with Carolina Nymark aka @poena helping out with the reviews.

What you need for the contributor day?

Besides a positive attitude, you will need to have your laptop in order to contribute to TRT projects. It would be great if you had a local development environment ready.
If you already have one you like to use, feel free to use it – what ever you feel most confident developing and working on.
If this is your first time contributing, and you haven’t worked on local developments, don’t be afraid, we got you covered.
In order to help us with contributions, you need some form of local development environment. This means that you need to have PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php., MySQLMySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com/. and ApacheApache Apache is the most widely used web server software. Developed and maintained by Apache Software Foundation. Apache is an Open Source software available for free. or NginxNGINX NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers. https://www.nginx.com/. installed somewhere on your system, in order for WordPress to run (or to run PHP_CodeSniffer – more on that later).

Windows users

Local by Flywheel – a simple to set up local development environment for WordPress
WAMP – another local development server, that doesn’t come with preinstalled WordPress unlike Local
XAMPP – also a local PHP development server
VVV – Varying Vagrant Vagrants is an open sourceOpen Source Open Source denotes software for which the original source code is made freely available and may be redistributed and modified. Open Source **must be** delivered via a licensing model, see GPL. Vagrant configuration focused on WordPress development. It also comes with preinstalled WordPress and some other useful tools (WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/, Node, Composer etc.) – preferred if you want to contribute to coding standards.
Microsoft Web Platform – if you want to set up local development without the help of predefined development environments listed above.

MacOS users

Local by Flywheel – works on PC and a Mac
VVV – also works great on Mac
MAMP – similar to WAMP and XAMPP but for MacOS

Linux users

If you have a Linux computer you can set up VVV, or set up local development by manually installing PHP, MySQL and Apache (or Nginx) web server (instructions for installing LAMP stack on Ubuntu 18.04, instructions for installing LEMP stack on Ubuntu 18.04).

Additional environments

If you are feeling more adventurous (or you are a bit more versed in the development area) you can set up a docker for local development.

Another tool which may help you for reviewing themes is a Chrome extension by BoldGrid – WPTRT Cloud Launcher. This extension will add a ‘Launch in Cloud’ button to any theme in the themes tracTrac Trac is the place where contributors create issues for bugs or feature requests much like GitHub.https://core.trac.wordpress.org/., and this will set up the theme with all the review tools in the cloud (no local environment required).

List of projects you can contribute to

This year the plan is to divide in several groups that will work on similar tasks, based on what you feel more comfortable working on.
TRT has an excel sheet with a list of open source projects we are working on . Based on that we have several projects you may want to help with

Theme reviews

The biggest thing that the TRT does is reviewing themes that will be added to the themes repository on wordpress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/.
Reviewing themes sharpens your own theme development skills, and is a great learning experience.

Useful starting point for getting involved with theme review is the following link: become a reviewer.

At the WCEU you can pick a theme from the themes trac, and start with the review making sure that the theme is functioning properly (no JS or PHP errors) and that it meets the required requirements. Carolina is an expert reviewer who can help you get started with the review, explain what things you need to take a closer look at and can help if you get stuck. Also feel free to ask questions on the slackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. channel – a lot of experienced reviewers from all over the world can help you with things that are unclear to you.

Theme SnifferTheme Sniffer Theme Sniffer is a plugin utilizing custom sniffs for PHP_CodeSniffer that statically analyzes your theme and ensures that it adheres to WordPress coding conventions, as well as checking your code against PHP version compatibility. The plugin is available from the plugin directory and Github. Themes are not required to pass the Theme Sniffer scan without warnings or errors to be included in the theme directory. pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party

Theme Sniffer is a plugin utilizing custom sniffs for PHP_CodeSniffer that statically analyzes your theme and ensures that it adheres to WordPress coding conventions, as well as checking your code against PHP version compatibility.

If you like to develop plugins using object oriented PHP this is a project you can help with. There are a list of open issues, that you can help with.

Theme Sniffer is a tool that helps theme authors create better themes by checking them for some common issues, and it can help reviewers as well when reviewing (ensuring that there are no big issues in a theme).

WPThemeReview coding standards

This project attempts to automate the code analysis part of the Theme Review Process as much as possible using static code analysis.

You don’t need to know how to write sniffs in order to contribute to this project (if you do know, that’s even better). You can go through the list of open issues in the repo and try to find as many examples of the rules as possible. You can even try to find examples in the current themes repository, using this awesome tool by Peter Booker wpdirectory.net

Theme Unit tests

Theme Unit tests is a repository that contains the sample data that can help you see if the theme will look good when installed – it adds some predefined content that cover most of the possibilities of how the content can look when a theme is installed.

There are some open issues on the repo as well, so if you’re interested in helping out you can start there.

Theme Feature repository

Justin Tadlock proposed in a post a TRT led repository where we would put some standardised packages that theme authors can utilise in their themes.

As Justin mentioned in the post: “The idea is that if we can get enough people together solving some common theme issues, then there’d be far fewer points of contention between theme reviewers and theme authors.”

This repository will have some useful examples of how to handle admin notices, have unobtrusive links in the customizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. etc.

If you have a good idea, or you can code some examples, feel free to contribute in the repository.

Final remarks

If you are interested in any of these projects feel free to comment here so that we can maybe pair into groups who want to work on a certain project. This will make it easier for us to make contributions during the contributor day on WCEU.

Of course, if you cannot attend the contributor day, you are welcomed to contribute to any of these projects any time. We welcome new contributors and will help with the onboarding to any of the project. Just drop us a line on the #themereview channel on slack.

Useful links

Contributor Orientation Tool
Contributor Day Q&A pt1
Contributor Day Q&A pt2
How to do a review
Working with trac

#contributor-day, #wceu

Multiple Accounts Requirement

We’re adding an explicit multiple accounts requirement because some authors don’t really have a limit, even if we have a Trusted Authors program and the queue is at an all time low. The current situation is not fair to our reviewers and to honest authors that believe quality is better than quantity.


You can have multiple accounts with the following restrictions:

  • You can’t have more than one (1) open ticket in any of the tracTrac Trac is the place where contributors create issues for bugs or feature requests much like GitHub.https://core.trac.wordpress.org/. reports/queues or under review. That means you can’t have one (1) theme ticket from an account and another one from a secondary account, simultaneously open in any of the queues.
  • Failing to respect the above requirement will result in the closing of all tickets and not having the possibility to upload those themes again. Also, a 1 month no upload possibility for each ticket closed. Depending on the severity of the case, you might also end up with a permanent ban on all your accounts
  • To avoid penalties, we request that you disclose all your accounts by emailing us at themes[at]wordpress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/.

In the last few days, we’ve penalised a few authors and are looking into other reports. Here are some stats:

  • 25+ accounts suspended
  • 4 TA accounts removed
  • 40+ themes suspended
  • Multiple penalties applied

To avoid such penalties, please refer to point 3 of the requirement.

New Privacy Policy page helpers coming in 5.2

In the WordPress 5.2 update new helpers have been added to make designing the Privacy Policy page easier.

In total 4 new items were added which are available to use in themes or plugins. There are 2 new CSSCSS CSS is an acronym for cascading style sheets. This is what controls the design or look and feel of a site. classes to help target the Privacy Policy page and menu items on the frontend, a new function that can be used in conditionals and a brand new template available to allow themes to design or style the Privacy Policy page anyway they choose.

  • is_privacy_policy() conditional query function
  • privacy-policy.php template
  • .privacy-policy body class
  • .menu-item-privacy-policy menu item class

You can start to take advantage of these items immediately upon the releaseRelease A release is the distribution of the final version of an application. A software release may be either public or private and generally constitutes the initial or new generation of a new or upgraded application. A release is preceded by the distribution of alpha and then beta versions of the software. of WordPress 5.2.

Backwards Compatibility

If the new additions are used on older versions of WordPress prior to 5.2 the template will not be used and the new CSS classes will not be output. The only backwards compatibility concern with using these new helpers is with the is_privacy_policy() function.

To support the is_privacy_policy() function pre-5.2 the following shim can be added to the theme or pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party;

<?php
if ( ! function_exists( 'is_privacy_policy' ) ) {
        function is_privacy_policy() {
                return get_option( 'wp_page_for_privacy_policy' ) && is_page( get_option( 'wp_page_for_privacy_policy' ) );
        }
}

Note for Themes about Core PHP Compatibility Changes in WordPress 5.2

With the releaseRelease A release is the distribution of the final version of an application. A software release may be either public or private and generally constitutes the initial or new generation of a new or upgraded application. A release is preceded by the distribution of alpha and then beta versions of the software. of WordPress 5.2 the minimum recommended PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php. version changes from minimum of PHP 5.2 to a minimum of PHP 5.6.

Themes hosted in the WordPress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ directory can choose to fully support any version of PHP they want – but you also must ensure it does not cause any fatal errors when it is run on any of the PHP versions that WordPress itself supports.

Themes should include their own method of handling PHP version compatibility and providing a graceful fallback when it’s run on unsupported versions. The most common way to do this is by preventing activation of your theme on versions of PHP which you do not support and notifying the user about why.

You can do that using the after_switch_theme hook, the phpversion() function or PHP_VERSION constant and version_compare(). Here is some example code that prevents theme activation on a server that’s PHP version is below 5.6.

<?php

/**
 * Set a constant that holds the theme's minimum supported PHP version.
 */
define( 'THEMESLUG_MIN_PHP_VERSION', '5.6' );

/**
 * Immediately after theme switch is fired we we want to check php version and
 * revert to previously active theme if version is below our minimum.
 */
add_action( 'after_switch_theme', 'themeslug_test_for_min_php' );

/**
 * Switches back to the previous theme if the minimum PHP version is not met.
 */
function themeslug_test_for_min_php() {

	// Compare versions.
	if ( version_compare( PHP_VERSION, THEMESLUG_MIN_PHP_VERSION, '<' ) ) {
		// Site doesn't meet themes min php requirements, add notice...
		add_action( 'admin_notices', 'themeslug_min_php_not_met_notice' );
		// ... and switch back to previous theme.
		switch_theme( get_option( 'theme_switched' ) );
		return false;

	};
}

/**
 * An error notice that can be displayed if the Minimum PHP version is not met.
 */
function themeslug_min_php_not_met_notice() {
	?>
	<div class="notice notice-error is_dismissable">
		<p>
			<?php esc_html_e( 'You need to update your PHP version to run this theme.', 'themeslug' ); ?> <br />
			<?php
			printf(
				/* translators: 1 is the current PHP version string, 2 is the minmum supported php version string of the theme */
				esc_html__( 'Actual version is: %1$s, required version is: %2$s.', 'themeslug' ),
				PHP_VERSION,
				THEMESLUG_MIN_PHP_VERSION
			); // phpcs: XSS ok.
			?>
		</p>
	</div>
	<?php
}

Test the new WPThemeReview standards

WPThemeReview is the official Theme Review Team coding standard used for checking the themes using PHP_CodeSniffer (PHPCS).

The aim of the WPThemeReview project is to automate the code analysis part of the Theme Review Process as much as possible using static code analysis.

ReleaseRelease A release is the distribution of the final version of an application. A software release may be either public or private and generally constitutes the initial or new generation of a new or upgraded application. A release is preceded by the distribution of alpha and then beta versions of the software. of WordPress Coding Standards 2.0.0

Version 2.0.0 of WordPress Coding Standards (WPCS) was released two weeks ago, and it brought some changes to the WPCS ruleset. Juliette Reinders Folmer made a pull request with the changes needed for WPThemeReview to work with WPCS 2.0.0.

We need your help in testing these changes before releasing an update.

To set the WPThemeReview in your theme you’ll need Composer.

The following instructions are based on Mac, but you have detailed instructions in the contributing document.

Go to your theme folder and from the terminal run

composer require wptrt/wpthemereview:dev-develop dealerdirect/phpcodesniffer-composer-installer:^0.4.4

This will install the develop branch of the WPThemeReview standards as well as composer pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party that will register all the standards with PHPCS. After that you can run

vendor/bin/phpcs -i

You should see

The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1, PSR12, PHPCompatibility, PHPCompatibilityParagonieRandomCompat, PHPCompatibilityParagonieSodiumCompat, PHPCompatibilityWP, WordPress, WordPress-Extra, WordPress-Docs, WordPress-Core and WPThemeReview

Then just run

vendor/bin/phpcs -p . --standard=WPThemeReview

You should see something like this


WW...W.W.....W......WWW.WW.W.WW.WW.....WEEEEEEEEEEEEEEWEEEEE   60 / 1197 (5%)
EEWEEEWEEEEEEEEEWEWEEEEEEEEEEEEEEEEEEEEEEEE.EEEEEEEEEEEEEEEE  120 / 1197 (10%)
E.E..EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE  180 / 1197 (15%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE  240 / 1197 (20%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES  300 / 1197 (25%)
EESSEESEESSSEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE  360 / 1197 (30%)
EEEEEEEEEEEEEEEEEEEEEWEEEE.EEEEEEE.EEEEEEEEEEEEEE.EEEEEEEEEE  420 / 1197 (35%)
EEEEEEEEEWEWWWEEEEWEEEE.EEEEEEEEEEEEEEEEEEEEEEEEEEEE.......W  480 / 1197 (40%)
W..WEWE.EEEEEEEEEEEEEEEEEEEE.E.EEWE..EWEEWEEEEW.EEWEWEEEEEEE  540 / 1197 (45%)
EEEEEEEEEEEEEEWEE.EWEE.EEEEE..EEEEEEEEEEEWEEEEEE.WEWEEEEE.E.  600 / 1197 (50%)
WWEEEEEEEEEE.E.EEEEEEEEE.E..EEEE..EE.E.EEE.EE.E.EEE..E.EEEEE  660 / 1197 (55%)
EEEEEEEEEE.EEEEEEE.W.EEEEEE..E.E..EEE.EEEEEWEE.EW..EWEEWWEEE  720 / 1197 (60%)
E.E..EEW..EEEEEEEEEEEEEEEEEE.EE.E.EEEEEEEEEEEEEEEEEEEEEEEEEE  780 / 1197 (65%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.WEWE.EEEE  840 / 1197 (70%)
EE..EE.E.EE..EE...EE...E..EEE..EE.EEE.EEEEEEEE.EEE.EE.EEEEEE  900 / 1197 (75%)
EEEEEE.EEEEEEEEEEEEEEEEEWEWE..EEEE.EEEEEEE...EEE..EE.EEEEEEE  960 / 1197 (80%)
EEEWEEEEEEE.EEEE.EEWEE.EEEEEEWWWEEEEEEEEEEE.EEEEE.EEEEEEEEEE 1020 / 1197 (85%)
EEEEEEEE.EEEE.E..E.EEWEE.EE.EEEE.EEEEEEEE..EEEEEEEEEEEEEEEEE 1080 / 1197 (90%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 1140 / 1197 (95%)
EEEEEEEEEEEEEEEEEEEEEEE.EE.....E.E.WEE.EEEEEEEEEEEE.EEEEE    1197 / 1197 (100%)



FILE: public_html/wp-content/themes/twentynineteen/functions.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 273 | WARNING | All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$primary_color'.
 274 | WARNING | All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found
     |         | 'twentynineteen_custom_colors_css'.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
...

If you find any errors or problems with setup feel free to report the issue on the Github or here in the comments.

#coding-standards, #wpthemereview