Skip to content

Instantly share code, notes, and snippets.

View cdils's full-sized avatar

Carrie Dils cdils

View GitHub Profile
@cdils
cdils / string-body-class.php
Last active January 4, 2016 00:09 — forked from norcross/string-body-class.php
Strip "color" id/value from querystring and use as body class. Prepends "theme-prefix-" to the color name. Example: For http://www.example.com/?color=blue the class would be "theme-prefix-blue."
<?php //remove opening tag
add_filter('body_class', 'string_body_class');
function string_body_class( $classes ) {
if ( isset( $_GET['color'] ) ) :
$classes[] = 'theme-prefix-' . sanitize_html_class( $_GET['color'] );
endif;
return $classes;
}
@cdils
cdils / crap-cleaner.php
Created January 14, 2014 17:04
Drop this in a theme's functions.php file and then resave every post/page. On saving the post/page, any inline styles will be wiped out.
<? php //remove this line
/**
* This function removes all the inline style markup from posts/pages on save.
*
* @todo Remove this code prior to site launch
*/
add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 );
function filter_post_data( $data , $postarr ) {
@cdils
cdils / change-style-load-order.php
Last active February 7, 2022 15:35
Change order of where Genesis child theme stylesheet is loaded on theme initialization.
<?php //Remove this line
/**
* Remove Genesis child theme style sheet
* @uses genesis_meta <genesis/lib/css/load-styles.php>
*/
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Enqueue Genesis child theme style sheet at higher priority
@cdils
cdils / comment-notes-before.php
Last active March 4, 2022 22:37
Customize the text before the comment form in WordPress. Note: Logged in users will not see this text.
<?php //remove this line
add_filter( 'comment_form_defaults', 'cd_pre_comment_text' );
/**
* Change the text output that appears before the comment form
* Note: Logged in user will not see this text.
*
* @author Carrie Dils <http://www.carriedils.com>
* @uses comment_notes_before <http://codex.wordpress.org/Function_Reference/comment_form>
*
<?php //remove this line
function disable_self_ping( &$links ) {
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, get_option( 'home' ) ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'disable_self_ping' );
@cdils
cdils / full-content-archives-genesis.php
Last active December 30, 2015 00:09 — forked from robneu/full-content-archives-genesis.php
Pretty much the same as Rob's original code, but changed the conditional for a custom post type archive.
<?php
add_action( 'genesis_before_loop', 'prefix_full_content_specific_cpt' );
/**
* Filter the output of specific CPT archives so that they display the full
* content regarldess of what's selected in the Genesis theme options panel.
*
* @author FAT Media <http://youneedfat.com>, Carrie Dils <http://www.carriedils.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
* @uses is_post_type_archive <http://codex.wordpress.org/Function_Reference/is_post_type_archive>
@cdils
cdils / utility-functions.php
Created November 30, 2013 18:52
Change line 139 of functions.php to gist below.
wp_enqueue_style( 'utility-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', array(), '4.0.3' );
<? php //remove this line
//** Add additional style to site header
add_filter('genesis_seo_title', 'wap_site_title' );
function wap_site_title($title) {
$custom_title = '<span class="custom-title">WA</span>Estate';
$inside = sprintf( '<a href="%s" title="%s">%s</a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), $custom_title );
$title = '<h1 class="site-title" itemprop="headline">'. $inside .'</h1>';
return $title;
}
@cdils
cdils / landing-page-template.php
Created November 19, 2013 13:53
Example of a Landing Page Template. Put this file in your child theme directory. To use it, create a page and set the template to "Landing."
<?php
/**
* This file adds the Landing template to the eleven40 Pro Theme.
*
* @author StudioPress
* @package Generate
* @subpackage Customizations
*/
/*
@cdils
cdils / custom-gravatar.php
Last active December 28, 2015 17:19
Replace the default "snowman" avatar with a custom image. Code lifted from this post -> http://www.bourncreative.com/how-to-create-a-custom-default-avatar-for-wordpress
<?php //Remove opening tag
function add_custom_gravatar( $avatar_defaults ) {
$myavatar = get_stylesheet_directory_uri() . '/images/custom-gravatar.jpg';
$avatar_defaults[$myavatar] = "Custom Gravatar";
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'add_custom_gravatar' );