Wordpress - AuniTech/DevTips GitHub Wiki

First steps

... @todo make a script

Building a website in Wordpress

Tools

Links

WP Command Line Interface

If you enjoy using the terminal while working you're probably annoyed by the hassle of installing plugins and doing configurations through the administration interface. To make this easier we have installed WP-cli on our development which enables you to manage a few tasks through the terminal. Here's a quick Introduction to WP Cli. Unfortunately this tool isn't as sophisticated as the Drupal version but if you find any plugins or decide to code an extension yourself, we'd bow before you

Kint Debugger

To get a proper var_dump in Wordpress we usually install Kint Debugger.

Depoying a site

Once you're ready to deploy a site, you should use our migrate.sh script. If you've built the site in the same structure we've described before, this script will find all links referencing a development checkout and change them to point to the live domain instead. You also have the option to supply information to the remote database so you can deploy it automatically.

We recommend using the script with migrate.sh -i to get an interactive prompt as there are quite many commands to remember. If you don't wish to deploy the dump you can just leave those questions empty, same with the search-n-replace functionality.

To get a database dump to search-n-replace you can use wp db export.

#Grandchild themes

A grandchild theme is the child theme of a child theme. Here's an example of how to create the theme twentytwelve-grandchild based on the theme twentytwelve-child:

mkdir twentytwelve-grandchild   
cd twentytwelve-grandchild
ln -s ../twentytwelve-child/*.php .
cp ../twentytwelve-child/style.css .

Open style.css with a text editor and change the name of the theme to a name of your choosing. If you need to modify one of the files which now are links delete the link and copy it over instead. So if you want to modify header.php:

cd twentytwelve-grandchild
rm header.php
cp ../twentytwelve-child/header.php .