- You need to have
composer
installed on your machine https://getcomposer.org/download/ - You need to have
NodeJS 12+
installed on your machine https://nodejs.org/en/download/ - You need to have
NPM
installed on your machine https://www.npmjs.com/get-npm - You will need a local working environment (WAMP, MAMP, etc).
- Create a new repository on github (lowercase/hyphenated), selecting 'adtrak' as the owner, and clone it to your local machine (
git clone [REPO URL] [FOLDER NAME]
) - Download latest release of WordPress https://wordpress.org/latest.zip
- Extract Wordpress to your new folder
- Delete the
wp-content
folder from your new folder - Download this boilerplate. Copy
wp-content
andexample.gitignore
to your folder - Rename the theme folder
- Move the
robots.txt
file from the repository download to the root of your WP install - Update
style.css
with your client name - Update screenshot.png with the client's branding
- Rename
example.gitignore
to.gitignore
and open the file - Edit lines
5
,6
&7
and replace the theme name to preventnode_modules
,dist
andvendor
files being committed - Create local database
- Open the Command Line / Terminal
- Change Directory to the theme folder (
cd /[FOLDER NAME]/wp-content/themes/[YOUR NEW THEME NAME]
) - Run
npm install
- Run
composer install
- Open
gulpfile.js
in the theme folder - Edit line ~
174
to the name of your local site. (e.g. my-new-site.vm) - Save the
gulpfile
- Visit your new site in the browser and set up Wordpress MAKE SURE YOU USE
adtrakwp_
AS YOUR TABLE PREFIX (thewp-config
file will be ignored by GIT) - You may need to edit the
wp-config.php
file to change charset. Add this line if this is the case:define( 'DB_CHARSET', 'utf8mb4' );
- Log in and activate relevant plugins (except WooCoommerce plugins if you're site will not use them - delete these if so)
- Activate your theme through the WordPress admin console
- Delete the
adtrak-skips
folder from your theme if you are not using it - Open the Command Line / Terminal and make sure you're in your theme folder
- Run
npm run dev
orgulp
npm run dev
will run thedevelopment
tasks, and won't minify your SCSS nor Javascript- Go to WordPress Settings
For the Gutenberg directions, see the README inside the theme.
- All components (
header
,footer
,phone-top-right
etc) can be found in_views/_components
- All functions (
script enqueuing
,Custom Post Types
,Custom Taxonomies
etc) can be found in_functions
- All page templates (
front-page.twig
,page.twig
, etc) can be found in_views
- Images, styles, js and fonts can be found in
_resources
- Follow steps 1-23 in the guide above
- Go to the Wordpress Admin area
- Select 'WooCommerce'
- Follow the Woocommerce Set Up Guide, entering your clients details as required
- Do not install any of the add ons when prompted
- Do not install Jetpack when prompted.
- Once complete, you can add payment gateways
- Go to WooCommerce -> Settings -> Payments (tab)
- Enable Paypal and Stripe and follow the set up guides
- Enable Paypal Sandbox / Stripe Test Mode whilst testing your WooCommerce website
- Once complete, you can add products to your website
- Select 'Products' -> Add New
- Scroll to the Product Data section and select your product options.
- Publish your products
- Continue to develop our theme
- Go to WordPress Settings
- Permalinks:
/news/%postname%/
- Discussion: CHECK: Before a comment appears, comment must be manually approved
- Discussion: CHECK: Users must be registered and logged in to comment
- Discussion: UNCHECK: Allow people to post comments on new articles
- Create home page, go to Settings > Reading, and front-page displays your new home page
- Create your menus, and change their display locations to suit
The following are useful locally and when setting up DeployHQ.
npm run dev
will run your local development
cd wp-content/themes/your-theme-name
npm install --save --quiet
npm run build
cd wp-content/themes/your-theme-name
composer install
You can use the following to exclude node_modules
from your uploads under "Excluded Files"
wp-content/themes/your-theme-name/node_modules/**
We have created a Tailwind config file that is easily editable in tailwind.config.js
. If you need to add colours, fonts etc., they can be added or edited in this file.
You can access the primary, secondary & tertiary colours by using classes as follows:
Default | Light | Dark |
---|---|---|
primary | primary-light | primary-dark |
secondary | secondary-light | secondary-dark |
Feel free to add your own extensions.
You can also use Tailwind colour generators to override standard colours. Using this, for example, means you override text-red-500
with your own hex colour of red, instead of using Tailwind's.
All boilerplates have Just-in-Time mode enabled and so CSS is generated on-demand. If you are injecting classes with JS or via WordPress admin, add your class to the safelist.txt and restart your local development server.
Due to the minified and purged size of Tailwind, we can inline our CSS completely using the Twig source
function. The new head.twig
import checks the URL - if its a local URL, it uses a normal stylesheet link. If not, it inlines all your CSS in the head.
This has been done in the adtrak-child-tailwind-twig-timber
theme.
In order for your images to work in CSS, simply use the full URL, e.g. background-image: url('/wp-content/themes/my-theme/_resources/images/tick.png');
The default Tailwind config can be found in tailwind.config-default.js
. This is included by default, and is purely here for reference.
For more help with Tailwind, don't forget the docs
Before you deploy a project, you need to build the production
assets.
To do this you need to run a different gulp
command.
It is recommended that DeployHQ handle this.
- Open deployHQ and go to your project
- Go to 'Build Pipeline' from the left hand menu
- Click 'NPM' from the Template options
- In the Command textarea, enter the content below:
cd wp-content/themes/your-theme-name
npm install --save --quiet
npm run build
Remember to change the command if you have changed the theme name!
- If you are using Timber/Twig, click 'Composer'
- Enter the content below
cd wp-content/themes/your-theme-name
composer install --no-progress
This is often good to test locally.
- In Terminal / Hyper / CMD, navigate to your theme directory
- Run
npm run build
(you can also usegulp --production
if you wish) - Check main.min.css is minified before deployment
Note: it's best that assets are built using DeployHQ