Skip to content

Instantly share code, notes, and snippets.

@cjkoepke
cjkoepke / home-top-text.html
Created March 21, 2015 15:59
The button code used on the Home Top Text Widget for the Church Pro Theme
<!--
DO NOT COPY THIS
The button code for the Home Top Text widget in Church Pro.
-->
<!-- COPY ONLY THE LINE BELOW -->
<a href="#" class="btn btn-white">Learn More About Us</a>
@cjkoepke
cjkoepke / footer-2-text-widget.html
Created March 21, 2015 19:11
The code used in the Text Widget in the Footer 2 Widget Area in the Church Pro Theme.
@cjkoepke
cjkoepke / functions.php
Last active November 5, 2015 13:51
Reposition the Primary Navigation to be right after the body tag. http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis/
<?php
//* Do NOT include the opening PHP tag
/**
* Reposition the Primary navigation at the top of the DOM.
* @author Calvin Koepke
* @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before', 'genesis_do_nav', 1 );
@cjkoepke
cjkoepke / functions.php
Last active November 5, 2015 13:50
Add a menu button to the Header, and a "Close Navigation" menu to the Primary Navigation for the off-canvas tutorial. http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis/
<?php
//* Do NOT include the opening PHP tag
/**
* Add the menu to the .site-header, but hooking right before the genesis_header_markup_close action.
* @author Calvin Koepke (@cjkoepke)
* @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
add_action( 'genesis_header', 'ck_menu_button', 14 );
function ck_menu_button() {
<?php
//* Do NOT include the opening PHP tag
/**
* Add the overlay div that will be used for clicking out of the active menu.
* @author Calvin Koepke (@cjkoepke)
* @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
add_action( 'genesis_before', 'ck_site_overlay', 2 );
function ck_site_overlay() {
@cjkoepke
cjkoepke / style.css
Last active November 5, 2015 17:02
Styling for a vertical navigation that is fixed and full-height. http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
/*
Title: How to Add a Mobile-Friendly, Off Canvas Menu in Genesis
Author: Calvin Koepke (@cjkoepke)
Link: http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
/* Genesis Navigation Menu
--------------------------------------------- */
.genesis-nav-menu {
jQuery( document ).ready( function( $ ) {
// @author Calvin Koepke (@cjkoepke)
// @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis/
// @version 1.1
// @license Free to use as you wish. Please share if you appreciate and link to the post above.
// Store our jQuery objects as variables
var body = $( 'body' ),
toggleButtons = $( '.menu-btn, .close-btn, .site-overlay' );
@cjkoepke
cjkoepke / functions.php
Last active November 5, 2015 16:58
Add JavaScript file to our body.
<?php
//* Do NOT include the opening PHP tag
/**
* Include the JavaScript
* @author Calvin Koepke (@cjkoepke)
* @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
add_action( 'wp_enqueue_scripts', 'ck_load_menu' );
function ck_load_menu() {
/*
Title: How to Add a Mobile-Friendly, Off Canvas Menu in Genesis
Author: Calvin Koepke (@cjkoepke)
Link: http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis
*/
/* Animation Settings and Classes
--------------------------------------------- */
.off-canvas-active,
@cjkoepke
cjkoepke / functions.php
Last active August 29, 2015 14:26
Apply a single custom class to the body element using a filter.
<?php
//* Do NOT copy this line or above
add_filter( 'body_class', 'ck_custom_body_class' );
function ck_custom_body_class( $classes ) {
$classes[] = 'custom-class';
return $classes;