Home Computing Guide to Writing WordPress Maintainable themes

Guide to Writing WordPress Maintainable themes

BioSci Computing team works with different entities to provide the school with Web reliable applications that strive to help with the day to day operations. This guide provides the principles of WordPress maintainable code in order to save time and resources when BioSci computing takes over the maintenance.

How to make WordPress theme maintainable

Follow the WordPress Coding Standards.

  • Adhere to WP Coding Standards makes your code clean and readable. Enforcing uniformity helps the BioSci computing team simplify code review and maintenance. Run your code through tools like PHPCS to check for issues and suggestions. Doing this can help improve or even do automatic fixes. For more information see: 

Proper use of  WordPress Hooks, Actions and Functions.

Including but not limited to:

Validate the code and standards-compliance.

  • There are many benefits to validating a site on W3C. Not only verifies the code is efficiently formatted and increase the possibility that all browsers handle correctly the content, but also helps to improve ranking in Search Engines.

Ensure the code doesn’t risk the security of the site.

  • For more information see: Guide to Secure Web Apps

Avoid duplicate code and stay on the DRY principle.

  • Identify the duplicate code and consider using hooks, actions, template parts, classes or functions to make the theme as efficient as possible preventing repetition.

Use WordPress theme folder and file structure.

  • No matter how simple or complex the theme is, keeping the theme files organized as WordPress suggests allows reduces time and effort in the maintenance.

Document your code.

  • Good comments in your code help BioSci Computing understand, at a glance, the section of code. It does not need to be long but efficient.

Test your theme.

  • Find and fix PHP and WordPress errors enabling debug settings, test the theme against different browsers. Write test scenarios whenever possible using tools like PHPUnit or Behat (preferred by BioSci Computing).

Make your theme accessible.

For more information see: https://make.wordpress.org/themes/handbook/review/accessibility

UCI BioSci Requirement

Theme version

  • Provide the theme with a version number and increment it on every update. 

Theme documentation

  • It is possible to use an HTML page to document the features of the plugin/theme describing shortcodes, widgets, page templates, theme/plugin specifications, theme/plugin options, etc.

Readme.txt 

  • Provide a readme file using the readme file  WordPress standards
  • Validate the file using the Reader validator tool
  • Provide instructions for the plugin/theme installation and setup
  • Add one section to describe how to create the assets in the case that the plugin/theme uses gulp, grunt, bower, sass, less, etc.
  • Changelog

Other resources:

Share This Post

Post Navigation