Skip to content

Instantly share code, notes, and snippets.

View tomusborne's full-sized avatar

Tom Usborne tomusborne

View GitHub Profile
@ControlledChaos
ControlledChaos / README.md
Last active February 28, 2018 18:01
Duplicate page headers in GeneratePress Premium.

Duplicate GeneratePress Page Headers

WordPress Snippet

@justintadlock
justintadlock / parent-theme-mod-fallback.php
Last active June 20, 2021 22:38
Get theme mods that fall back to the stored parent theme mod if child theme is active.
<?php
/**
* The purpose of this code is to show how you can use theme mods that will fall back to
* the already-set mods of the parent theme. So, when a child theme is active, the code
* checks, in the following order: 1) child theme mod, 2) parent theme mod, 3) default.
*/
function jt_get_theme_mod( $name, $default = false ) {
if ( is_child_theme() )
@grantambrose
grantambrose / 1functions.php
Created September 12, 2016 22:23
WordPress: Change the main menu on different pages
// Conditionally change menus
add_filter( 'wp_nav_menu_args', 'bb_wp_nav_menu_args' );
function bb_wp_nav_menu_args( $args = '' ) {
// change the menu in the Header menu position
if( $args['theme_location'] == 'header' && is_page('1159') ) {
$args['menu'] = '32'; // 32 is the ID of the menu we want to use here
}
return $args;
}
( function( api ) {
'use strict';
// Add callback for when the header_textcolor setting exists.
api( 'header_textcolor', function( setting ) {
var isHeaderTextDisplayed, linkSettingValueToControlActiveState;
/**
* Determine whether the site title and tagline should be displayed.
*