WordPress Theme Developer Handbook - Getting Started

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is a theme?

A WordPress theme changes the design and layout of your website. Changing a theme changes the look of the website on the frontend.

Other Sources Become a theme reviewer: https://make.wordpress.org/themes/handbook/get-involved/become-a-reviewer/

Additionally, all themes published in the theme directory are reviewed for standards prior to being published. Reviewing themes in the directory is a great way to better understand how theme development works and is a good way to get inspiration for your own theme.

PHP constants for debugging. WP_DEBUG, WP_DEBUG_LOG, WP_DEBUG_DISPLAY

Configuring debugging is an essential part of WP theme development. WP provides a number of constants for debugging. WP_DEBUG: PHP constant that triggers the built-in debug mode of your WP installation. This allows to view the errors in the theme. WP_DEBUG_LOG: This is used in conjunction with WP_DEBUG to log all error messages to a debug.log within the WordPress /wp-content/ directory. WP_DEBUG_DISPLAY: WP_DEBUG_DISPLAY is used to control whether debug messages display within the HTML of your theme pages. To display error messages on the screen as they occur, configure this setting to 'true' within your wp-config.php file. define( 'WP_DEBUG_DISPLAY', true ); With the WP_DEBUG and WP_DEBUG_DISPLAY enabled, error messages will display at the top of your site pages.

Plugins https://developer.wordpress.org/themes/getting-started/setting-up-a-development-environment/#plugins

Debug Bar (WordPress plugin) Debug Bar adds an admin bar to your WordPress admin providing a central location for debugging. Query Monitor (WordPress plugin) Query Monitor allows debugging of database queries, API request and AJAX called used to generate theme pages and theme functionality. Log Deprecated Notices (WordPress plugin) Log Deprecated Notices logs incorrect function usage and the use of deprecated files and functions in your WordPress theme. Monster Widgets (WordPress plugin) Monster Widget consolidates the core WordPress widgets into a single widget allowing you to test widgets styling and functionality in your theme. Developer (WordPress plugin) Developer helps optimize your development environment by allowing easy installation of tools and plugins that help in troubleshooting and ensuring code quality. Theme-Check (WordPress plugin) Theme-Check tests your theme for compliance with the latest WordPress standards and practices.

Do I need to license my themes under the GPL? #Do I need to license my themes under the GPL?

If you have no plans to distribute your theme then you do not need to adopt the GPL license for your work. The GPL only applies to distributed software. If you are not distributing your software - for example, a theme used only by yourself or on your local machine - you do not need to adopt the GPL. If you wish to submit your creation to the free theme repository on WordPress.org, it must be 100% GPL compliant, including CSS and image files. Because the freedoms spelled out in the GPL are at the heart of WordPress, we encourage developers to distribute their themes with a 100% GPL-compatible license.

WordPress theme review guidelines Guidelines: https://make.wordpress.org/themes/2013/11/10/guidelines-shouldnt-fail-a-theme/ WordPress coding standards: https://make.wordpress.org/core/handbook/best-practices/coding-standards/

In addition to the above development tools, it's a good idea to stay up to date on the WordPress.org Theme Review Team's *Guidelines* for theme submission and guidance on meeting *WordPress Coding Standards*. These guidelines are the "gold standard" for quality theme development and are useful, even if you don't plan on releasing a theme on WordPress.org.

What is the difference between a theme and a plugin?

It is common to find cross-over between features found in themes and plugins. However, the generally, - a theme controls the presentation of content; whereas - a plugin is used to control the behavior and features of the WordPress site. Any additional functionality should be added as a plugin ( not directly to the theme ). This way the user does not lose the functionality when she/he change the theme. By moving critical features to plugins, you make it possible for the design of your website to change, while the functionality remains the same.

Supporting older versions of WP

It's standard practice for WordPress themes to support at least two versions back to ensure a minimum of backward compatibility. You can refer to the WordPress Roadmap page to access older versions of WordPress. Then you can download and install older WordPress versions, creating multiple development sites, each running different WordPress versions for testing. Wordpress roadmap: https://wordpress.org/about/roadmap/ https://wordpress.org/about/history/

Theme Development Examples: Default "Twenty" themes: https://developer.wordpress.org/themes/getting-started/theme-development-examples/#default-twenty-themes Underscores theme (_s): https://underscores.me/

One of the best ways to understand theme coding standards is to find examples of other themes that have been written with these standards in mind.

Other important parts of WordPress Development Toolset

Test data and plugins.

What is "free" in the context of software?

The 'free' in free software, refers to freedom and not price. Free software can come with a price tag. In other words, you can create a GPL theme and sell it for $50, and it would still be free software. Why? Because the user is free to run, modify, and distribute the software or any modifications of that software.

Keeping it free for all

The freedoms of the GPL don't only apply to the original piece of software; works derived from GPL-licensed software must also adopt the same license, without restrictions or additional terms.

WordPress Licensing and the GPL

The license under which the WordPress software is released is the GPLv2 (or later) from the Free Software Foundation. The GPL establishes the following four freedoms: 1. Freedom to run the program for any purpose. 2. Freedom to study how the program works and to change it, so it performs computing as you wish. 3. Freedom to redistribute copies, so you can help your neighbor. 4. Freedom to distribute copies of your modified versions, giving the community a chance to benefit from your changes. The GPL only applies to distributed software.

What can themes do?

Themes take the content and data stored by WordPress and display it in the browser. When you create a theme you decide how that content looks and is displayed. Good themes improve engagement with websites's content in addition to looking beautiful.

Required files

There are only 2 files that are absolutely required in a WP theme. 1. index.php - the main template file 2. style.css - the main style file Though not required, themes contains additional files such as, php files(templating files), Localization files, CSS files, JavaScript, Graphics and text files.

What this handbook will cover?

This handbook provides the basic information required to develop WordPress themes, including in-depth coverage of essential template tags and functions. The purpose of this handbook is to give you a solid foundation for WordPress theme development, to provide step-by-step instruction in building basic themes, and to provide tips and resources useful in furthering your skills.

What are themes made of?

WordPress themes are a collection of different files that work together to create what you see, as well as how your site behaves.

Theme Unit Test Data https://developer.wordpress.org/themes/getting-started/setting-up-a-development-environment/#plugins

WordPress.org theme unit test data: is an XML file containing dummy test data that you can upload to test how themes perform with different types and layouts of content. WordPress.com theme unit test data: is dummy test data that you can upload to a WordPress installation to test your theme, including WordPress.com-specific features.

WordPress local development environment

You will need a local server stack and a text editor. Options include: 1. Local Sever Stack LAMP - Linux Apache MySql/MariaDB PHP A local server stack, such as LAMP or WAMP is a server (much like the server that runs on your web server), which you will configure on your local machine. You can install pre-bundled programs that contain all of these, like MAMP (for Mac), or XAMPP (Mac or Windows) to quickly setup your environment. 2. Virtualized environment A virtualized environment created with Vagrant and VirtualBox allows you to create easily reproducible development environments. Varying Vagrant Vagrants (VVV) is a popular Vagrant option which creates a WordPress development environment. VVV: https://varyingvagrantvagrants.org/ VVV is ideal for developing themes and plugins as well as for contributing to WordPress core. Text editor: Popular choices are Atom, Sublime Text, and PhpStorm.

Setting up a Development Environment Why set up the development environment?

Your development environment can either be local or remote. Configuring a local environment to work on your WordPress theme is beneficial for several reasons: - You can build your theme locally without relying on a remote server. This speeds up your development process and allows you to see changes instantly in your browser. - You do not need an Internet connection to build your theme. - You can test your theme from a variety of perspectives. This is important, especially if you plan on releasing your theme to a larger audience and want to ensure maximum compatibility.

Code reference

https://developer.wordpress.org/reference/

Further resources for installing WP development tools and theme testing

https://developer.wordpress.org/themes/getting-started/setting-up-a-development-environment/#further-resources

Further reading about WordPress and GPL

https://developer.wordpress.org/themes/getting-started/wordpress-licensing-the-gpl/#further-reading

Themes on wordpress.org Theme review guidelines

https://wordpress.org/themes/ https://developer.wordpress.org/themes/release/theme-review-guidelines/


Set pelajaran terkait

World Geography: Chapter 7, "Mexico"

View Set

NFS Exam 2 Ch.6 REAL ONE other one is 3

View Set

Chapter 1 part 1.2 The Biosphere

View Set

July 14: Therapeutic 85...Value: 28

View Set

Chapter 26: Urinary Test Bank Review

View Set

Chapter 6 - Human Resource Decision-Making in Organizations

View Set

Project Management: The Managerial Process (7 Ed.) - Chapters 1 - 6

View Set

Physiology Ch 7 Assignment and Quiz

View Set