Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / facetwp-pagination-genesis-markup.php
Last active September 24, 2021 18:54
Adjust FacetWP's pager html to match Genesis markup. This allows it to inherit the Genesis theme styles. Used with [facetwp pager="true"]
<?php
/**
* Style pagination to look like Genesis.
*
* @version 1.0.0
*
* @author Mike Hemberger @JiveDig
*
* @link https://gist.github.com/JiveDig/b9810ba4c322d7757993159ed9ccb61f
@JiveDig
JiveDig / mai-menu-colors.css
Created February 9, 2018 15:09
Mai Theme navigation menu colors.
/* Header navigation link color */
.home .nav-header .current-menu-item > a,
.nav-header .nav-search,
.nav-header .nav-search:focus,
.nav-header a {
color: #323232;
}
/* Header navigation current/hover link color */
.nav-header a:hover,
@JiveDig
JiveDig / mai-button-colors.css
Created February 9, 2018 15:02
Change button colors on Mai Theme.
/* Main button color */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button,
.entry-content .button,
.menu-item.highlight a,
.woocommerce a.button,
.woocommerce button.button,
@JiveDig
JiveDig / disable-mai-sticky-shrink-header.php
Created October 18, 2017 14:59
Disable sticky header and shrink header from Mai Pro (https://maipro.io).
<?php
/**
* Disable sticky header and shrink header from Mai Pro.
*
* @param array The existing body classes.
*
* @return array Modified classes.
*/
add_filter( 'body_class', 'prefix_disable_mai_sticky_shrink_header', 30 );
@JiveDig
JiveDig / create-new-mai-favorite.php
Created September 27, 2017 20:43
Starter code to create a new Favorite for use with Mai Favorites plugin (https://maipro.io)
<?php
$favorite_id = wp_insert_post( array(
'post_author' => 1,
'post_excerpt' => '',
'post_status' => 'publish',
'post_title' => '',
'post_type' => 'favorite',
'_thumbnail_id' => '',
'meta_input' => array(
@JiveDig
JiveDig / acf-json-nested-tabs.json
Last active October 18, 2017 22:34
A Genesis-based page template for ACF Pro that allows nested tab groups. 1st level is horizontal tabs, 2nd level is vertical tabs. Uses Flexington for columns (not required but would need additional CSS. Works as-is in https://maipro.io.
[
{
"key": "group_59c02d79966e4",
"title": "Tabbed Content",
"fields": [
{
"key": "field_59c02db106f90",
"label": "Tabs",
"name": "tabs",
"type": "repeater",
@JiveDig
JiveDig / genesis-force-p-site-title.php
Created September 18, 2017 17:10
Force the Genesis site title to use 'p' whenever an 'h1' would be used.
<?php
// Force the site title to use 'p' whenever an 'h1' would be used.
add_filter( 'genesis_seo_title','prefix_force_p_site_title_wrap', 99, 3 );
function prefix_force_p_site_title_wrap( $title, $inside, $wrap ) {
$title = str_replace( '<h1', '<p', $title );
$title = str_replace( '</h1>', '</p>', $title );
return $title;
}
@JiveDig
JiveDig / sidebar-content-sidebar-equal-widths.php
Created July 28, 2017 16:43
Mai Pro - Force primary and secondary sidebars to the same width
<?php
// Add near the bottom of functions.php, without the above <?php
// Force secondary sidebar to 1/4th width on Sidebar Content Sidebar layout.
add_filter( 'genesis_attr_sidebar-primary', function( $attributes ) {
$layout = genesis_site_layout();
if ( 'sidebar-content-sidebar' !== $layout ) {
return $attributes;
}
$attributes['class'] = str_replace( 'col-lg-4', 'col-lg-3', $attributes['class'] );
@JiveDig
JiveDig / mai-adjacent-post-nav-by-category.php
Last active July 27, 2017 18:59
Add adjacent post navigation to posts in a specific category, by ID.
<?php
// Remove adjacent post nav.
add_action( 'after_setup_theme', function(){
remove_post_type_support( 'post', 'genesis-adjacent-entry-nav' );
});
/**
* Add adjacent post navigation to posts
* in a specific category, by ID.
@JiveDig
JiveDig / recursive-term-metadata.php
Created July 21, 2017 14:05
Get the specified metadata value for the term or from one of it's parent terms.
<?php
/**
* Get the specified metadata value for the term or from
* one of it's parent terms.
*
* @param WP_Term $term Term object
* @param string $key The meta key to retrieve.
* @param bool $check_enabled Whether to check if custom archive settings are enabled.
*