A small framework that provides the way to develop model-based Wordpress themes
Create a composer.json
for your theme:
composer init
Then add to your composer.json
:
"minimum-stability": "dev",
"require": {
"alterfw/alter": "0.1.x"
}
Run composer:
composer install
After this, add this line to your functions.php:
require_once "vendor/autoload.php";
Checkout our documentation on readthedocs.org.
You can also contribute with the documentation in the separated repository.
Fell free to help to improve Alter, you can make pull requests or improve the documentation also.
If you make a Pull Request of a new feature, make sure to link the documentation Pull Request and to write the respective tests.
We use Vagrant to create the Alter Development Environment. To setup, follow this instructions:
Clone our fork of Vagrantpress:
git clone https://github.com/alterfw/vagrantpress
And start the virtual machine:
cd vagrantpress;
vagrant up
So, with the Vagrant VM on, you need to replace the alter dependency (installed over composer) by your clone of the repository;
vagrant ssh
cd /vagrant/wordpress/wp-content/themes/example-theme-master/vendor/alterfw
rm -rf alter
git clone [email protected]:alterfw/alter.git
Note: if you are using Windows you cannot use vagrant ssh
, follow this instructions to setup PuTTY.
When writing tests please make sure to follow the Arrange-Act-Assert pattern.
To run the tests you need first to setup the development environment.
After this you can run the tests simply:
cd /vagrant/wordpress/wp-content/themes/example-theme-master/vendor/alterfw/alter
phpunit
If you receive any errors running phpunit
, run vagrant provision
and try again.