Skip to content

Instantly share code, notes, and snippets.

@cjkoepke
cjkoepke / style.css
Created November 15, 2015 22:53
Add specific border-left-color to each menu item, depending on its custom class.
/* Primary Navigation - Colors
--------------------------------------------- */
/* Yellow */
.nav-primary .genesis-nav-menu .menu-item > a.yellow:hover:before,
.nav-primary .genesis-nav-menu .menu-item.yellow.current-menu-item > a:before {
border-left-color: #FFE066;
}
/* Green */
@cjkoepke
cjkoepke / functions.php
Last active March 28, 2016 04:24
Add google fonts to your theme.
<?php
//* Do NOT copy the opening PHP tag
//* Add Google Fonts to our header
add_action( 'wp_enqueue_scripts', 'ck_load_google_fonts' );
function ck_load_google_fonts() {
wp_enqueue_style( 'ck-google-fonts', '//fonts.googleapis.com/css?family=Open+Sans', array(), CHILD_THEME_VERSION );
}
@cjkoepke
cjkoepke / functions.php
Created December 1, 2015 03:15
Add a blank tracker DIV to the end of an article in Genesis. For use with the Progress Bar tutorial on calvinkoepke.com
<?php
//* Do NOT include the opening PHP tag
//* Add end of content tracker
add_action( 'genesis_after_entry_content', 'ck_content_tracker' );
function ck_content_tracker() {
echo '<div id="end-of-content"></div>';
}
@cjkoepke
cjkoepke / functions.php
Created December 1, 2015 03:17
Add a progress bar to your Genesis child theme.
<?php
//* Do NOT copy the opening PHP tag
//* Add progress bar
add_action( 'genesis_before', 'ck_progress_bar_markup' );
function ck_progress_bar_markup() {
echo '<div class="progress-bar"><div class="progress-bar-inner"></div></div>';
}
@cjkoepke
cjkoepke / style.css
Created December 1, 2015 03:28
Style a progress bar to be 100% of our window.
/* Progress Bar
--------------------------------------------- */
.progress-bar {
position: fixed;
top: 0;
left: 0;
height: 5px;
width: 100%;
background: #f5f5f5;
@cjkoepke
cjkoepke / functions.php
Last active December 2, 2015 21:25
Modify the comment respond title.
<?php
//* Do NOT copy the opening PHP tage
//* Modify the comment respond title
add_filter( 'comment_form_defaults', 'ck_comment_form_title' );
function ck_comment_form_title( $defaults ) {
$defaults[ 'title_reply' ] = __( 'Leave a Reply', CHILD_THEME_TEXT_DOMAIN );
return $defaults;
@cjkoepke
cjkoepke / login.php
Last active December 17, 2015 02:11
A login page template for WordPress.
<?php
/*
Template Name: Login/Logout Page
*/
//* Remove our default page content
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
//* Add custom login form to our page content
add_action( 'genesis_entry_content', 'ck_do_login_form' );
@cjkoepke
cjkoepke / functions.php
Created January 5, 2016 02:22
Reposition page title and keep the entry title in the loop
<?php
add_action( 'genesis_meta', 'producer_handle_titles' );
function producer_handle_titles() {
//* Default entry header markup
add_action( 'genesis_after_header', 'producer_entry_header_markup_open', 5 ); /* Function below */
add_action( 'genesis_after_header', 'genesis_do_post_title', 8 );
add_action( 'genesis_after_header', 'producer_entry_header_markup_close', 15 );
@cjkoepke
cjkoepke / functions.php
Created February 17, 2016 15:46
Example code of badly prefixed functions.
<?php
/*
* Example code of badly prefixed functions.
*
*/
add_action( 'genesis_after_header', 'sp_third_navigation' );
function sp_third_navigation() {
// Code
@cjkoepke
cjkoepke / functions.php
Created February 19, 2016 22:39
Example code of properly prefixed functions.
<?php
/*
* Example code of properly prefixing your functions
* Unique identifier: ck
*
*/
add_action( 'genesis_after_header', 'ck_third_navigation' );
function ck_third_navigation() {