- Contributing to WordPress
- Contributing to WordPress Core with code
- Trac
- Patches
- Version control
- Local Installation
- npm
- Contribute
- You have (basic) experience with localhost setup (Apache/Nginx/Other)
- You have (basic) knowledge of Version Control (Git/SVN)
- You have npm and Node.js setup (if not, it's time to setup)
- We'll need Grunt
npm install grunt -g
andnpm install -g grunt-cli
- You have a WordPress.org profile
If some of these are not true, we'll get back to this a bit later and help you out!
Let's start with some general Contributing to WordPress
Now we can move to Contribute with Code Let's review the general page and get acquainted with the workflow
History reasons
GitHub, at some point, maybe?
https://core.trac.wordpress.org/
We'll be working with patches, yeah!
The official WordPress develop repository suggest using Docker
https://varyingvagrantvagrants.org
Varying Vagrant Vagrants ( VVV )
I have a custom local URL - http://wpbleeding.local
hosts
file
127.0.0.1 wpbleeding.local
My apache2.conf setup
# This is for WordPress Bleeding
<VirtualHost *:80>
DocumentRoot /var/www/html/wpbleeding/src/
ServerName wpbleeding.local
ServerAlias wpbleeding.local
<Directory /var/www/html/wpbleeding/src/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
wpbleeding, utf8mb4_general_ci
https://tinyurl.com/y6sgf8pj
We'll be working with the Git version from GitHub https://github.com/WordPress/wordpress-develop
I've used SVN for quite some time :)
We need to install the Package, using npm
For that reason, you'll need a few tools if you don't have them locally:
npm install grunt -g
- install Gruntnpm install -g grunt-cli
npm install node-sass -g
- these might need sudo access (not the best practice)
You might need at some point
npm rebuild node-sass --force
npm
https://i.imgflip.com/11e8zh.jpg
Now, we assume all of the npm packages you need are up and running. Let's install WordPress Core
Navigate to the folder and clone the repository:
git clone [email protected]:WordPress/wordpress-develop.git wpbleeding
this will take some time, be patient
We might need to fix file permissions for the folder
Open the local URL and we'll see https://tinyurl.com/yyr5hqub
Before running any build tasks you need to make sure the dependencies are installed. You can install these by running npm install
.
this will take some time
The next step is to run
npm run dev
This one will build the setup and you'll be able to install WordPress, following the standard steps.
Let's refresh the page, enter the database details
There you go! You have the WordPress development mode setup locally.
We are ready, let's contribute!
- We saw Trac, Patches, how can we get involved
- We have setup a few npm packages we are going to need
- We have WordPress develop locally
- We should be ready
You can find more details here Build tools: We’ve enabled running WordPress from /src again
grunt watch --dev
- To build WordPress while developing
JavaScript files are placed in /src/js/_enqueues/
directory.
CSS Files are editable directly.
Developers can now run grunt watch --dev
while working on JS files.
Once you are ready and need to build the JavaScript and CSS into src
use grunt build --dev
to automatically rebuild JavaScript and CSS files when their source is changed.
I suggest running this command when you are ready with your patch and you can prepare it for submitting.
Use branches for tickets
e.g. if you work on a ticket 1234, you can created a new branch git checkout -b ticket-1234
If you need to reset to the original stable state, run
git reset .
or reset each file/folder separately and run
grunt build --dev
This will restore all JS/CSS files and all changes
https://core.trac.wordpress.org/
Good First Bugs for New Contributors
- This does not need to be an easy patch - it can be a very well documented feature/bugreport/etc
You grat a ticket, work in it and you have the fix/update, nice!
https://make.wordpress.org/core/handbook/contribute/git/#patches