Skip to content

Instantly share code, notes, and snippets.

@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 / 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
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 / 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
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 / 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 / style.css
Created November 15, 2015 22:47
Add animation to our left sidebar menu, emphasis on icons.
/* Primary Navigation - Animated
--------------------------------------------- */
.nav-primary .genesis-nav-menu a,
.nav-primary .genesis-nav-menu a:before,
.nav-primary .genesis-nav-menu .menu-item {
-webkit-transition: all .10s ease-in-out;
-moz-transition: all .10s ease-in-out;
-ms-transition: all .10s ease-in-out;
-o-transition: all .10s ease-in-out;
@cjkoepke
cjkoepke / style.css
Created November 15, 2015 22:26
Adjust site structure and container to accommodate for an 80px wide left sidebar menu.
/* Container
--------------------------------------------- */
.site-container {
margin-left: 80px; /* Compensate for 80px side nav */
}
.site-inner,
.wrap {
max-width: 1120px; /* Compensate for 80px side nav */
@cjkoepke
cjkoepke / style.css
Last active November 15, 2015 22:45
Apply a fixed nav to the left of the viewport. Styled to accommodate Icons in the menu.
/* Primary Navigation
--------------------------------------------- */
.nav-primary {
background-color: #242831;
height: 100%;
left: 0;
position: fixed; /* Make our navigation stick to the left of the viewport at all times */
top: 0;
width: 80px;
@cjkoepke
cjkoepke / functions.php
Created November 15, 2015 20:45
Limit a specified menu to a specified depth.
<?php
//* Do NOT copy the opening PHP tag
//* Set menu depth to one level
add_filter( 'wp_nav_menu_args', 'ck_limit_nav_depth' );
function ck_limit_nav_depth( $args ) {
if( $args['theme_location'] == 'primary' )
$args['depth'] = 1;