Air-light (or simply Air) is designed to be a ultra minimal starting point for a WordPress project at Digitoimisto Dude Oy, a Finnish boutique digital agency in the center of Jyväskylä. Theme is originally based on _s. We welcome all happy contributors with open arms! See roadmap.
- CSS gzipped: 16.8 KB (originally 124.4 KB)
- JS gzipped: 8.6 KB (28.6 KB original)
- Front page HTML: 7.4 KB (29.4 KB original)
This theme is constantly kept up to date by a bunch of awesome contributors. Wanna join in development? Read the instructions for contributing and let us know about your first PR!
Air-light is built to be very straightforward, backwards compatible, front-end developer friendly and modular by its structure. Following Underscores and WordPress Theme Coding Standards best practices and most of the changes in _s are implemented as soon as they are committed.
Our mission and goal is minimalism and simplicity. Our vision is to build a theme that will not implement its own wrappers or functions, will not use any templating languages that would take things further from traditional PHP or CSS, will contain nothing that people will not use or need. Air-light will be free of weird "app-like" folder structures or odd syntaxes that nobody else uses. We love WordPress as it was and as it is.
Air was renamed to air-light in version 3.7.8 (March 20th, 2018), because air was already taken in the official WordPress theme directory.
Air-light v. 4.2.2 was approved to official WordPress theme directory on June 4, 2018. But please note, all changes you do to the theme without generating your own or changing textdomain will be overridden in theme updates - so if you use this theme as a starting point, please follow instructions and/or replace the textdomain with your own.
Fully keyboard accessible navigation!
- Usage
- Please note before using
- License
- Features
- Extra building blocks
- Requirements
- Recommendations for development
- How to build a new theme
- Contributing
- Notes
Air is a development theme, so it has updates very often. By using this starter theme, you agree that the anything can change to a different direction without a warning when you look at this dev-git the next time. Please note this theme has no updates inside WordPress by design. Use this theme to hack it to pieces and create your new awesome theme based on Air! Please also see Debuggers!
Air is not meant to be "a theme for everyone", which means it doesn't have all the parts that are generally included in multi-purpose themes for non-technical people (please see Disabled features).
If you want to use this theme as starter for your new theme, please note the theme won't necessarily be that much fun or won't look good by default and needs work from you. We recommend using Sage if you need something more extended.
Air is licensed with The MIT License (MIT) which means you can freely use this theme commercially or privately, modify it, or distribute it, but you are forbidden to hold Dude liable for anything, or claim that what you do with this is made by us.
We try to follow traditional WordPress Template Hierarchy as much as possible. This way we will provide a low threshold for junior developers and go hand in hand with official WordPress Theme Coding Standards.
Please see Visual Overview if you are interested in how the WordPress theme structure works.
Here's the current Air-light theme structure (prone to changes, not updating in real time, but stays mostly the same in its pricinpals):
themes/your-theme-name/ # → Root of your air-light based theme
├── 404.php # → Default "not found" page
├── archive.php # → Default archive template
├── bin/ # → Scripts
│ ├── ... # → This scripts are used for generating themes or new Air-light version
│ └── newtheme.sh # → The start script for creating YOUR own theme out of Air-light
├── comments.php # → Default comments template (can be deleted if not needed)
├── css/ # → CSS files for production (never edit)
│ ├── dev/ # → Unminified stylesheet files for debugging (never edit)
│ └── prod/ # → Minified stylesheet files for production (never edit)
├── fonts/ # → Your webfont files (woff, woff2, ttf needed)
├── footer.php # → Site footer
├── front-page.php # → Demo front-page template (not included in wordpress.org version)
├── functions.php # → Set up your theme basic settings
├── gulp/ # → Gulp related settings and tasks
│ └── ... #
├── gulpfile.js # → Core gulpfile for air-light development
├── header.php # → Site header
├── images/ # → Your theme images, for example default featured images and placeholders
├── inc/ # → Theme core PHP
│ ├── hooks/ # → Hook functions
│ ├── includes/ # → Non-template features
│ ├── template-tags/ # → Template functions and helpers
│ ├── post-types/ # → Custom Post Types
│ ├── taxonomies/ # → Custom Taxonomies
│ ├── hooks.php # → All hooks the theme runs are here
│ ├── includes.php # → Include non-template features
│ └── template-tags.php # → Include template functions and helpers
├── js/ # → JavaScript files
│ ├── dev/ # → Unminified script files for debugging (never edit)
│ ├── prod/ # → Minified script files for production (never edit)
│ └── src/ # → Script files for development (edit these)
│ ├── navigation.js # → Accessible multi-level navigation (from 3.4.5)
│ ├── front-end.js # → Theme core JavaScript file (from 1.0.0, before: scripts.js)
│ └── sticky-nav.js # → Sticky nav functionality (optional)
├── package.json # → Node.js dependencies and scripts
├── page.php # → Default page template
├── phpcs.xml # → PHPCodeSniffer/WordPress Theme Coding Standards settings
├── sass/ # → SCSS files for CSS development
│ ├── base/ # → Theme base styles
│ │ └── _accessibility.scss # → Accessibility
│ ├── global.scss # → Core CSS file that calls all the modular files
│ ├── gutenberg-editor-styles.scss # → Core CSS file for Gutenberg editor and blocks
│ ├── components/ # → Add your style components to this folder
│ ├── features/ # → Fuctionality styles
│ │ ├── _gallery.scss # → Default WordPress gallery feature styles
│ │ ├── _gravity-forms.scss # → Defaults for Gravity Forms + WCAG 2.0 form fields for Gravity Forms
│ │ ├── _lazyload.scss # → Styles for air-helper lazyload feature (lazyload.js needed)
│ │ ├── _top.scss # → Back to top styles
│ │ ├── _pagination.scss # → Numbered pagination styles
│ │ ├── _sticky-nav.scss # → Sticky nav styles (not included by default)
│ │ └── _slick.scss # → Styles for slick-carousel (not included by default)
│ ├── gutenberg/ # → Gutenberg block styles for both core and custom blocks
│ │ └── ... # → WIP
│ ├── helpers/ # → Helper mixins and functions
│ │ ├── _animations.scss # → Animations and effects
│ │ ├── _aspect-ratio.scss # → A mixin for aspect ratio
│ │ ├── _general.scss # → Mixins for general use, or helpers of other mixins
│ │ ├── _grid.scss # → CSS Grid helper mixin
│ │ └── _typography.scss # → Typography style mixins
│ ├── layout/ # → Fuctionality styles
│ │ ├── _forms.scss # → Styles for general forms and Gravity Forms
│ │ ├── _site-footer.scss # → Footer styles
│ │ ├── _site-header.scss # → Header styles
│ │ ├── _typography.scss # → Defaults for typography and fonts
│ │ └── _gutenberg.scss # → Site-side styles for Gutenberg (pratically for single.php)
│ ├── navigation/ # → Navigation styles
│ │ ├── _burger.scss # → Burger styles and animations
│ │ ├── _nav-desktop.scss # → Desktop navigation styles and dropdowns
│ │ └── _nav-mobile.scss # → Navigation styles for mobile and touch devices
│ ├── variables/ # → Configurations
│ │ ├── _breakpoints.scss # → Widths from mobile to TV screens
│ │ ├── _colors.scss # → All the colors of the theme
│ │ ├── _font-face.scss # → Define font variables here
│ │ ├── _font-family.scss # → Define font paths
│ │ ├── _font-size.scss # → Define font related sizes
│ │ ├── _forms.scss # → Form related variables
│ │ └── _spacings.scss # → Margins and paddings
│ ├── views/ # → Templates, archives, pages and views go here
│ │ ├── _404.scss # → Default 404 styles
│ │ ├── _comments.scss # → Comment styles (optional)
│ │ ├── _front-page.scss # → Front page styles (empty by default)
│ │ └── _search.scss # → Default search result styles
├── screenshot.png # → Theme screenshot for WP admin
├── search.php # → Default search view
├── sidebar.php # → Default sidebar (optional)
├── single.php # → Default single article or CPT view
├── style.css # → Theme meta information
├── svg/ # → Your theme SVG graphics and icons
└── template-parts/ # → WordPress template parts. Modules go under this folder.
├── header/ # → Header modules
│ ├── branding.php # → Site branding
│ ├── navigation.php # → Site navigation
└── hero.php # → Default hero
Some features, WooCommerce support and personal preferences of Dude are moved to Air helper plugin.
- Gutenberg-ready
- Flexbox-ready
- CSS Grid-ready
- SVG-ready
- SASS-support (SCSS-syntax)
- CSS reset from sanitize.css
- Section blocks and containers
- Basic and minimal CSS framework for forms, commenting and typography
- Responsive typography with viewport units with fallbacks, see more in sass/layout/_typography.scss and sass/base/_helpers.scss, default syntax is
@include responsive-font($font-size-min, $font-size-max);
(formerly Megatype, still recommended with blogs or text-only based sites, but not included by default after 1.5.0) - Web fonts file are preferred, helper included: Sass Boilerplate's fontFace-mixin. Put files in
fonts/
directory, you'll need .odt, .ttf, .woff, .woff2. Then just@include fontFace('Proxima Nova', '../../fonts/proximanova-regular-webfont', 400);
in _typography.scss.
- BrowserSync for keeping multiple browsers and devices synchronized while testing, along with injecting updated CSS and JS into your browser while you're developing (included in devpackages)
- gulp build script that compiles both Less and Sass, checks for JavaScript errors, optimizes images, and concatenates and minifies files (see Dude's devpackages)
- npm for front-end package management
- WCAG 2.0 accessible with keyboard and screen readeres, aria roles and labels included
- Custom navigation walker
- Support for multi-level drop down submenus
- Support for both absolute and relative navigation
- Improved version of the accessible menu for WordPress themes, fully accessible and responsive multi-level navigation
- Support for animations
- Hover intent with minimal animations
- Accessible mobile menu
- Wide selection of tasty hamburger animations
- Available for translation, full Polylang Pro support
- Support for Post Thumbnails on posts and pages
- Gutenberg support
- HTML5 core markup for WordPress elements
- Air specific: Hero template, section blocks
Air-light can register your CPT:s automatically.
- Add your custom post type to theme settings under post_types, located in
functions.php
like this:
'post_types' => [
'your-post-type' => 'Your_Post_Type'
]
- Add a file
inc/post-types/your-post-type.php
- Extend
Post_Type
class withYour_Post_Type
and define your post type in a public function calledregister()
. See the example:inc/post-types/your-post-type.php
.
Air-light can register your Taxonomies automatically.
- Add your taxonomy to theme settings under taxonomies, located in
functions.php
like this:
'your-taxonomy' => [
'name' => 'Your_Taxonomy'
'post_types' => 'post, page'
]
- Add a file
inc/taxonomies/your-taxonomy.php
- Extend
Taxonomy
class withYour_Taxonomy
and define your taxonomy in a public function calledregister()
. See the example:inc/taxonomies/your-taxonomy.php
.
Air-light uses namespaced PHP since 5.0.0. This means that we no longer need to prefix functions and hooks, because namespace Air_Light;
takes care of that.
When old function format was:
// Pre_get_posts
add_action( 'pre_get_posts', 'dude_pre_get_posts' );
function dude_pre_get_posts( $query ) {
// Do something
}
New format goes like this:
// Pre_get_posts
add_action( 'pre_get_posts', __NAMESPACE__ . '\pre_get_posts' );
function pre_get_posts( $query ) {
// Do something
}
Creating accessible websites is really important and our goal is to make air as accessible-ready as possible. Theme fully supports navigating with keyboard and screen-readers. Other accessible features:
- Navigation patterns
- Skip to content link
- Smart focus for keyboard users, what-input baked in
- Valid HTML
- Accessible SVG icons
- Screen reader class
- External link indicators
- Underlined links
- Content-aware back to top link
- WCAG 2.0 AAA Accessible-ready Gravity Forms styles (needs WCAG 2.0 form fields for Gravity Forms, included in dudestack)
From 4.7.1 air-light has a lazy loading image features for background images and imgs. If you don't use this feature, remove it from scripts. This feature depends on air-helper, check out the documentation in air-helper for further instructions.
- Widgets
- Post formats
- Jetpack support
- (Threaded) comments
- Underscores Template tags
- Sidebar
All .js files in /js/src/*
is built to production bundles in /js/prod/
folder and development bundles in /js/dev/
folder with the same name and loaded corresponding to the WP_ENV environment variable. The production scripts can be loaded on development by using ?load_production_builds
URL parameter. The main scripts file loaded in front end is /js/src/front-end.js
.
If you want to add a piece of custom JS, create a file under /js/src/modules/
and import or require it in /js/src/front-end.js
. If you need a admin-specific JS, add a /js/src/admin.js
and then enqueue /js/dist/admin.js
with enqueue_admin_scripts
Our build uses babel to translate scripts to ES2015 compatible JS, so you can use modern JS syntax without thinking about backwards compatibility. There is a /js/src/legacy.js
file, which contains the needed polyfills for browsers not supporting the ES2015 syntax and is automatically loaded on the header when such browser is detected.
We use Airbnb es-lint presets spiced up with our own flavors.
Air has a sticky navigation baked in.
You can enable the navigation by
- Adding sticky-nav.js to your gulpfile (already included with Devpackages and bin/newtheme.sh start script)
- Uncommeting sticky-nav import in global.scss
- Restart gulp and save scripts.js once to compile working combined javascript file
Air includes sassified version, clean SCSS file for slick carousel.
To enable Slick carousel support,
- Run
npm install slick-carousel --save
in theme directory - Run
npm update
in theme directory - Uncomment
// import slick from 'slick-carousel';
in scripts.js - Add slick init to document ready in scripts.js, like this, tweak to your needs:
$('.slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
dots: false,
fade: true
});
- Construct your slider like this:
<section class="block block-slider">
<div class="container">
<div class="cols slider">
<div class="col item">
<p><b>Slider item 1</b> Some other content. Lorem ipsum in proident deserunt nostrud. Lorem ipsum in proident deserunt nostrud.</p>
</div><!-- .item -->
<div class="col item">
<p><b>Slider item 2</b> Something different to see the change. Lorem ipsum in proident deserunt nostrud culpa veniam sed esse aliqua ea velit aute.</p>
</div><!-- .item -->
</div>
</div>
</section><!-- .block -->
Please note: If you want to change the background to lighter, you will need to edit the svg arrows accordingly.
Air had by default a basic WooCommerce support from version 1.9.2, and for a while it was been separated to its own repository, air-woocommerce since v2.5.6.
Starting from v2.6.0 WooCommerce support comes with Air helper plugin and Air contains optional very basic WC styles. Air helper will add it's WC functionality when theme support for WooCommerce is added. To enable:
- Get Air helper
- Activate the plugin
- PHP >= 7.4
- Requires at least: WordPress 4.7.1
- Tested up to WordPress 5.9.0
- macOS
- Devpackages - Npm and Gulp + plugins
- Dudestack - A toolkit for creating a new professional WordPress project with deployments. Heavily based on Bedrock by Roots.
Please refer to Wiki section Getting started in theming with Air-light.
See Documentation.
If you have ideas about the theme or spot an issue, please let us know. Before contributing ideas or reporting an issue about "missing" features or things regarding to the nature of that matter, please read Please note section. Thank you very much.
If you want to contribute to the development, please follow these instructions:
- Create a fork of this repository (or new branch if you have editor/maintainer permissions)
- Make your changes
- Create a pull request
If you want to improve air, you have two options.
Air is originally built on dudestack. Install our development environment with these steps (unix only, sorry Windows!):
mkdir -p /var/www && cd /var/www/ && git clone https://github.com/digitoimistodude/dudestack
- Go to bin folder
cd /var/www/dudestack/bin
and runbash wsl.sh
orbash macos.sh
depending on your platform. Follow instructions. - Run
createproject
, name project after airdev when asked - Wait for the project to be created (get a coffee, first time can take couple of minutes)
- Create a fork of air-light (press fork button on GitHub) (or if you are Dude staff, just create new branch for changes)
- Go to the theme folder of your WordPress instance via Terminal (
cd /var/www/airdev/content/themes
) - Clone your fork with
git clone [email protected]:yourusername/air-light.git
(replace yourusername with your actual username) - Cd to your new cloned repository
cd /var/www/airdev/content/themes/air-light
- Get the dependencides by running
npm install
inside the theme folder (if you don't have npm installed, see here or just use homebrew) - Wait npm to get through files (get another cup of coffee)
- Activate theme - if you are using the lightweight macos-lemp-setup:
cd /var/www/airdev && vendor/wp-cli/wp-cli/bin/wp theme activate air-light
- Open whole project to your preferred coding editor, for example when using Visual Studio Code that would be
code /var/www/airdev/content/themes/air-light
or via GUI (Open folder). - Go to back to air-light dir with
cd /var/www/airdev/content/themes/air-light
and then rungulp
and start developing! Please note, contributing to this theme is only possible when gulp is run from theme directory, NOT on project root.
You may want to add alias wp='./vendor/wp-cli/wp-cli/bin/wp'
for macos-lemp-setup to be able to run WP-CLI with just wp
.
To install air-light to your own development environment, just clone your fork to your theme directory, activate the theme, and make changes. If you make changes to front-end (JS/SCSS), you'll need to use our gulpfile and npm dependencies, so make sure you go through steps 9-10 and 12 above.
When you make changes, commit them with clear describing commit messages and them make a pull request. We are happy to accept improvements!
Next you just need to add content and menu via airdev.test/admin, or you can use the ready-made content:
cd ~/Projects/airdev
wp plugin install wordpress-importer --activate
wget https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml
wp import theme-unit-test-data.xml --authors=create
Air-light comes with PHP_CodeSniffer for PHP files, stylelint for SCSS/CSS files and eslint for JS files built inside gulpfile.js. Please note, you need to configure global versions of these separately!
It's also recommended to use Query Monitor plugin, as some debugging messages goes straight to it's logger.
PHP_CodeSniffer needs to be installed under /usr/local/bin/phpcs
with WordPress-Coding-Standards for php-debuggers to work properly in gulp. If you don't want to use phpcs with gulp, you can disable it by commenting out or deleting line gulp.watch(phpSrc, ['phpcs']);
.
The golden rule here is to make sure the commands stylelint
, eslint
and phpcs
work from command line.
mkdir -p ~/Projects && cd ~/Projects && git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
git clone -b master https://github.com/PHPCompatibility/PHPCompatibility
git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
- Please note: Replace yourusername name with your actual user name!
sudo ln -s /Users/rolle/Projects/phpcs/bin/phpcs /usr/local/bin/phpcs
sudo chmod +x /usr/local/bin/phpcs
- Please note: Replace yourusername name with your actual user name!
phpcs --config-set installed_paths "/Users/rolle/Projects/wpcs","/Users/rolle/Projects/PHPCompatibility"
- Test your standards with
phpcs -i
, it should display something like this:
The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1, PSR12, PHPCompatibility, WordPress, WordPress-Extra, WordPress-Docs and WordPress-Core
npm i stylelint eslint -g
- Check that other linters work:
stylelint -v
,eslint -v
It's also best to have all stylelint
, eslint
, phpcs
living inside your editor. We think Visual Studio Code is best for this, check out the plugins inside vscode-settings repository to make sure everything is installed.
This release cycle will release a new version to:
Whenever you have updates that are worthwile, commit them with clear commit messages and then do versioning. Every meaningful commit or bunch of commits that form a feature together make the version go up semantically 0.0.1.
Use bash alias (replace YOURUSERNAME with your own):
alias release_new_air_version='git push && git push --tags && rsync -av -e ssh --exclude={"/node_modules/*","/bin/*","/sass/*"} $HOME/Projects/airdev/content/themes/air-light/* [email protected]:/var/www/dudetest.xyz/public_html/air/content/themes/air-light/ && cd $HOME/Projects/airdev/content/themes/air-light/bin && sh air-move-out.sh && sh air-pack.sh'
The release cycle:
- Commit your changes or merge a pull request
- Search and replace version in style.css, functions.php, package.json, readme.txt, CHANGELOG.md. Remember update Tested up WordPress version as well.
- Add a tag with
git tag -a x.x.x
commands, add the same description than in CHANGELOG.md - Run
release_new_air_version
(this will move dotfiles etc. out, take care of packing and will give the URL for uploading to WordPress.org) - Follow script instructions (do a theme check and upload the theme)
- Run
sh air-move-in.sh
. This will move dev-version back and restore the git functionality.
That's it, you released a new version!
Gzip file sizes tested with wc -c css/prod/global.css
and gzip -c css/prod/global.css | wc -c
commands.
Theme developers please note: if you use phpcs in SublimeLinter as custom standard on dudestack, you will need extra content/themes/air-light subfolders inside theme directory for it to work on both global projects and with air-light.
See tool related issues in devpackages and air-light issue tracker.