Cornerstone is built with SASS, and if you build your child theme with SASS, you’ll be shocked at how fast you can make a ton of changes. Though you are able to use CSS, Cornerstone was optimized for SASS.
Initial Child Theme Setup
To begin you must create the basic file structure like any other WordPress child theme. Below is an example. UITS has already compiled a starter kit for you in your sandbox.
Your Cornerstone Starter kit should consist of:
javascripts
min
starterkit.min.js
starterkit.js
sass
variables.scss (SASS variables are located here)
css
variables.css
screenshot.jpg
functions.php
README.md
style.css
style.scss (This is the ideal place to do style changes)
Understanding SASS
The SASS variables available to you come from three possible documents. Cornerstone registers a large number of new variables mostly pertaining to navigation and widgets.
This is the pre-compiled Bootstrap scss in the global directory, and it has hundreds of variables.
Cornerstone registers a large number of new variables, mostly pertaining to navigation and widgets.
Sherman, a child theme built with SASS, can redefine any of the variable in Bootstrap or Cornerstone before they are compiled. Rather than wrestling with a dizzying number of selectors and tracking down every single place a single color or font may be referenced, you can edit a few variables and be 80% complete with your redesign. It’s fantastic!
Using a Compiler
In order to make changes, you will have to edit style.scss using the SASS variables. You will also need a SASS compiler. A common one is PREPROS.
Using Prepros
Editing variables.scss
Once you have a general understanding of the variables and the file structure you can start editing variables.scss. This file contains listed default variables from both Bootstrap and Cornerstone. A change is simple: search for your target tag and change the attribute to whatever you would like it to be.
Overview of the variables.scss file
Example
To change the default link color for the navigation bar you would have to scroll down to the “$navbar” variables and make the changes you would like.
Variables we will be changing. The hex codes would be located here.Look before any changes have been made to variables.Look after changes have been made. Now, the navigation bar links are light blue!
Editing style.scss
In order to edit the style of your theme you will need to edit it using SASS in style.scss. Variables do not go in style.scss.
Example
Below is an example of how you can change the style of your theme’s master header.
Header before a style change.Changes to styles.scss files.Theme after style.scss change has been applied.
Typically, a child theme will @import the css of the parent theme. Bootstrap 3, the framework which Cornerstone is based on, offers very limited support for Internet Explorer 8. By default, a Bootstrap 3 site in IE8 will render the mobile view. One column of content, and the collapse mobile navigation.
Being that IE8 accounts for a sizable (~7%) of traffic on Aurora, Cornerstone makes use of respond.js, which uses javascript to mimic media queries for IE8. However, respond.js will not work on anything loaded via @import. So this alternate method is required.
Child themes are a way to take an existing theme, such as Sherman, and change a couple of things about it. For developers looking to create something custom, we highly recommend looking into child themes first.
Hale 2015 was a theme released in August 2015 as a part of Aurora Update 9. The bold blue Sherman theme was released in the summer of 2014, and its advanced features and customization options proved very popular. However, a number of customers requested a theme with all the functionality of Sherman but with the softer tones of the original Hale theme that was released in 2013. Hale 2015 addresses this issue, adapting the popular Hale design and keeping the powerful features of Sherman. A child of the Cornerstone theme, Hale 2015 will continue to benefit from all new features added to Aurora for years to come.
Sherman is a child theme of Cornerstone, and utilizes SASS to be as lightweight as possible. Its design is bold, yet clearly a product of the university. It is named after Roger Sherman, Connecticut’s representative to the Continental Congress, and one of the Founding Fathers.
Sherman is a child theme of Cornerstone, and utilizes SASS to be as lightweight as possible. Its design is bold, yet clearly a product of the university. It is named after Roger Sherman, Connecticut’s representative to the Continental Congress, and one of the Founding Fathers.
UConn currently has four central themes as well as a number of custom themes and child themes created for specific UConn sites.
Plugins
To ensure the security and stability of Aurora, plugins are limited to set number determined by the Aurora Governance Committee. Plugins do get added regularly, but must be thoroughly tested and reviewed for compatibility with existing plugins.
Custom Themes and Plugins
Custom development is allowed for the Aurora WordPress server, but each plugin and theme, as well as any update, will have to go through Code Audit before being allowed in the system. Contact webdev@uconn.edu if you're interested in starting a custom project to get a development environment, and to be added to the developer contact lists. You may also want to look at our Live Sites with Custom/Child Themes.
If you add a sidebar with a menu widget, you may notice that the menu is displayed in a very simple manner. Below is code that you can add to your custom CSS to add some style to your sidebar menu. This code will work with websites using the Hale 2015 and Sherman themes.
Code
#page-sidebar .widget.widget_nav_menu {
padding-left:0;
padding-right:0
}
#page-sidebar .widget ul {
margin:0
}
#page-sidebar .widget ul li {
padding:1em;
margin:0
}
#page-sidebar .widget ul li.current-menu-item,#page-sidebar .widget ul li.current-menu-item:hover,#page-sidebar .widget ul li.current-menu-item:active {
background:#0f4786
}
#page-sidebar .widget ul li:hover,#page-sidebar .widget ul li:active {
background:#dbe3ed
}
#page-sidebar .widget ul li.current-menu-item a,#page-sidebar .widget ul li.current-menu-item:hover a,#page-sidebar .widget ul li.current-menu-item:active a {
color:#fff
}
Note: The colors are marked in red — feel free to change them to whatever HEX codes you want!
Result
To see how this CSS code looks on an actual sidebar menu, visit the Development page.