Skip to content

Instantly share code, notes, and snippets.

View michaelbourne's full-sized avatar

Michael Bourne michaelbourne

View GitHub Profile
@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;
}
@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-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-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 / 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 / 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 / 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-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-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-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 });