Skip to content

Instantly share code, notes, and snippets.

View michaelbourne's full-sized avatar

Michael Bourne michaelbourne

View GitHub Profile
@michaelbourne
michaelbourne / pro-builder-indicator-with-posts.php
Last active November 21, 2018 20:12
Adds a custom column to the admin Pages/Posts list indicating if the page was built in Pro. Only use one of these snippets.
<?php
// Add visual indicator to pages and posts built in Pro
// =============================================================================
function bourne_identity_columns( $columns ) {
$myCustomColumns = array(
'probuilder' => __( 'Builder' )
);
$columns = array_merge( $columns, $myCustomColumns );
@michaelbourne
michaelbourne / custom-fonts.js
Last active February 25, 2019 23:07
Add custom font families to the Pro font manager
(function(){ var config = cornerstoneApp.lookup('service:store').peekRecord('option','cornerstone_font_config');config.set('value.customItems', [ { family: 'MikesFont', stack: 'MikesFont, sans-serif', weights: [ '300', '500' ]}]);config.save()})();
@michaelbourne
michaelbourne / single-product-ajax-add-to-cart.js
Last active June 14, 2018 18:02
JS and PHP needed for Single Product template to use AJAX Add To Cart functionality
jQuery(document).ready(function($){
// The X/Pro "Added to cart" overlay
var notification = $('.x-cart-notification');
$(".single_add_to_cart_button").on('click', function(e) {
e.preventDefault();
var quantity = $('input[name="quantity"]').val(),
@michaelbourne
michaelbourne / x-pro-anchor-link-scroll.js
Last active May 28, 2018 21:52
Override deafult scroll handling for anchor links, set offset for sticky header.
@michaelbourne
michaelbourne / x-js-grid.js
Created May 2, 2018 19:48
X Theme / Pro Theme javascript based grid
(function($){
$(window).on('ready load resize', function(){
var max = 0,
mobile = $(window).width(),
numChildren = $('.jsmethodgrid').first().children().size();
$(".jsmethodgrid .x-column").css('min-height','inherit');
if ( mobile > 767 ){
$('.jsmethodgrid .x-column').css({ 'width' : 100/numChildren + '%', 'margin': 0 });
@michaelbourne
michaelbourne / x-equalize-columns-unique.js
Created May 2, 2018 19:45
X Theme / Pro Theme Equalize Columns with each row being unique
(function($){
$(window).on('load resize', function() {
$(".equalize").each(function(index, el) {
var max = 0,
mobile = $(window).width();
$(this).find(".x-column").css('min-height', 'inherit');
$(this).find(".x-column").css('height', 'auto');
if ( mobile > 767 ){
$(this).find(".x-column").each(function(index, el) {
if( $(this).outerHeight() > max ){
@michaelbourne
michaelbourne / x-equalize-columns.js
Created May 2, 2018 19:43
X Theme / Pro Theme Equal Height Columns
(function($){
$(window).on('ready load resize', function(){
var max = 0,
mobile = $(window).width();
$(".equalize .x-column").css('min-height', 'inherit');
if ( mobile > 767 ){
$(".equalize .x-column").each(function(index, el) {
if( $(this).outerHeight() > max ){
max = $(this).outerHeight();
@michaelbourne
michaelbourne / x-responsive-timeline.css
Created April 25, 2018 22:02
Responsive Cornerstone Timeline
@media (min-width: 768px){
.timeline {
position: relative;
z-index: 1;
}
.timeline::before {
content:"";
position: absolute;
z-index: 1;
top: 0;
@michaelbourne
michaelbourne / x-transparent-fixed-header.js
Created April 25, 2018 22:01
Transparent Fixed Header (Opaque on Scroll)
jQuery(document).ready(function($){
// Detect if this is a hero image page by looking for the #heroimage ID
if( $('#heroimage').length ){
// get the value of the bottom of the #heroimage element by adding the offset of that element plus its height, set it as a variable
var mainbottom = $('#heroimage').offset().top + $('#heroimage').outerHeight(true);
$(window).on('scroll',function(){
var stop = Math.round($(window).scrollTop());
// If the use has scrolled past the bottom of the hero image
@michaelbourne
michaelbourne / x-transparent-fixed-header.css
Created April 25, 2018 22:00
Transparent Fixed Header (Opaque on Scroll)
/** set up our navbar, and position it fixed so there is no white gap above the CS content **/
.x-navbar {
border: none;
box-shadow: none;
transition: background 0.7s ease-out;
background: transparent!important;
position: fixed;
z-index: 1030;
top: 0;