We should do a tiny bit more setup just to make things smoother as we progress. First I want you to install wp-cli – this is the “WordPress – Comand Line Interface”. I won’t be using it much, but you will find it’s often used in documentation so I found it useful to have.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Now, lets move it from whatever directory you just put it in, and make it accessible everywhere
chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
Read about the advantages and cleaner markup using soil on the official sage soil page here You will notice it costs money, however, it is released under the MIT license which means we can install it and use it free of charge. They do great work and the support given from paying for this plugin is small compared to the benefits of bedrock/sage/soil. So use the plugin now to try it out but once the site is launched circle back around and pay for the license.
composer require roots/soil
Back in your theme folder (bedrock/web/app/themes/name) reload everything
npm run start
Go to your admin panel and activate the Soil plugin.
Take a look in the app/setup.php file, this one is important and you will likely use it a lot, you add theme support, menus and image sizes here. Lets just add a new image size for now, around line 50 you will find this :
/* * Enable post thumbnails * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support('post-thumbnails');
underneath, lets add our new image size
add_image_size('post-featured', 1280, 628, true);
We will come back to this file as we develop our theme. Our next tutorial will show you how to tackle the menu, but before we do this let’s install the Theme Unit Test dummy content. On the linked page, you will find an XML file to download. This will add a bunch of test content, including items we can add to our menu. Once you have it downloaded, go to your admin panel and Tools > Import and install the importer :
Lastly, once the install has finished, click “Run Importer” and then choose the downloaded XML file and import some dummy data using the setting below
All set for tackling the menu!