Skip to content

Instantly share code, notes, and snippets.

View michaelbourne's full-sized avatar

Michael Bourne michaelbourne

View GitHub Profile
@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;
@michaelbourne
michaelbourne / x-custom-tabs.js
Created April 25, 2018 21:58
Create Your Own Custom Tabbed Content
(function($){
$('#tabsection .x-container').on('click', '.x-column', function(){
var textshow = $(this).index('#tabsection .x-column');
$('#textsection .x-container').addClass('hidden');
$('#textsection .x-container').eq(textshow).removeClass('hidden');
});
})(jQuery);
@michaelbourne
michaelbourne / x-custom-tabs.css
Created April 25, 2018 21:57
Create Your Own Custom Tabbed Content
/** flex the tabs to make the shrink down for mobile **/
#tabsection .x-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
@michaelbourne
michaelbourne / swap-columns-mobile.css
Created April 25, 2018 21:55
Swap Columns on Mobile
@media (min-width: 768px) {
.x-section .x-container.swapcolumns {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}
@michaelbourne
michaelbourne / pro-colors-anywhere.php
Last active February 25, 2019 23:19
How to use Themeco Pro template colors anywhere on your site
/**
* Get theme colors from Pro and turn them into classes and CSS variables
* Author: Michael Bourne
*/
$themecolors = get_option('cornerstone_color_items');
if($themecolors) {
$css = '<style type="text/css" id="themecolours">';
$colors = json_decode( stripslashes( $themecolors ), true );
@michaelbourne
michaelbourne / override-header-assignment-5.php
Created April 25, 2018 21:37
Override the Pro Theme header assignment for specific pages and conditions
add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
$user = wp_get_current_user();
if (is_search()) {
$match = 1234; // the post ID for your header
}
elseif (is_404()) {
$match = 4567; // the post ID for your header
}
return $match;
@michaelbourne
michaelbourne / override-header-assignment-4.php
Last active March 19, 2019 23:42
Override the Pro Theme header assignment for specific pages and conditions
add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
$user = wp_get_current_user();
if (in_array( 'author', (array) $user->roles )) {
$match = 1234; // the post ID for your header
}
return $match;
}
@michaelbourne
michaelbourne / override-header-assignment-3.php
Created April 25, 2018 21:37
Override the Pro Theme header assignment for specific pages and conditions
add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
if (is_user_logged_in()) {
$match = 1234; // the post ID for your header
}
return $match;
}
@michaelbourne
michaelbourne / override-header-assignment-2.php
Created April 25, 2018 21:37
Override the Pro Theme header assignment for specific pages and conditions
add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
if (is_404()) {
$match = 1234; // the post ID for your header
}
return $match;
}
@michaelbourne
michaelbourne / override-header-assignment-1.php
Created April 25, 2018 21:36
Override the Pro Theme header assignment for specific pages and conditions
add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
if (is_search()) {
$match = 1234; // the post ID for your header
}
return $match;
}