Skip to content

Instantly share code, notes, and snippets.

Avatar

Carrie Dils cdils

View GitHub Profile
@cdils
cdils / 0_reuse_code.js
Created Jan 31, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cdils
cdils / what-template-is-this.php
Created Jan 31, 2014
Figure out what template file is being used. Don't use on live sites. :)
View what-template-is-this.php
<?php //remove opening tag
add_action( 'wp_head', 'show_template' );
function show_template() {
global $template;
print_r( $template );
}
View front-page.php
<?php
/**
* This file adds the Home Page to the Winning Agent Pro Theme.
*
* @author Carrie Dils
* @package Winning Agent Pro
* @subpackage Customizations
*/
@cdils
cdils / search-bar.php
Last active Aug 29, 2015
Show the search bar on the home page only of the Winning Agent Pro Theme
View search-bar.php
<?php //remove opening php tag (this entire line)
// Add search widget below header
add_action( 'genesis_after_header', 'wap_search_bar' );
function wap_search_bar() {
if ( ! is_front_page() ) {
return;
}
View office-hours-template.php
<?php
/**
* Template Name: Office Hours Template
* Description: Used as a page template to show page contents, followed by a loop
* through the "Genesis Office Hours" category
*/
// Add our custom loop
add_action( 'genesis_loop', 'cd_goh_loop' );
@cdils
cdils / body-class-conditional.php
Created Apr 7, 2014
Use body class as a conditional
View body-class-conditional.php
<?php //remove this line
function conditionl_widgets() {
$classes = get_body_class();
// If body class doesn't include 'full-width-content', BOUNCE
if in_array( 'full-width-content', $classes) {
return;
@cdils
cdils / post_nav.php
Created Apr 8, 2014
Add (in category) post navigation to the bottom of single posts and throw some Genesis styles around it.
View post_nav.php
<? //remove this line
// Add Prev/Next post navigation within a single category
add_action( 'genesis_after_entry', 'cd_prev_next_posts_nav' );
function cd_prev_next_posts_nav() {
//bail if we're not on a single post
if ( ! is_single() ) {
return;
}
@cdils
cdils / simple-social-icons.php
Created May 1, 2014
Pre-load styles for simple social icons
View simple-social-icons.php
// Default Simple Social Icon Styles
add_filter( 'simple_social_default_styles', 'minmimum_default_style' );
function minmimum_default_style( $defaults ) {
$defaults['size'] = '100';
$defaults['border_radius'] = '100';
$defaults['icon_color'] = '#fff';
$defaults['icon_color_hover'] = '#fff';
$defaults['background_color'] = '#404435';
$defaults['background_color_hover'] = '#3c4556';
@cdils
cdils / author-post-info.php
Last active Aug 29, 2015
Two methods to add post author avatar to entry header
View author-post-info.php
<?php // remove this line
/**
* Add author avatar to post info output
*
* @uses get_avatar() <http://codex.wordpress.org/Function_Reference/get_avatar>
* @uses get_author_posts_url() <http://codex.wordpress.org/Function_Reference/get_author_posts_url>
*/
add_filter( 'genesis_post_info', 'cd_post_info_filter' );
function cd_post_info_filter( $post_info ) {
@cdils
cdils / Customize the Contact Info Fields in WordPress Profiles 6
Last active Aug 29, 2015
Add custom contact fields in the WordPress User Edit screen.
View Customize the Contact Info Fields in WordPress Profiles 6
// Customize the contact information fields available to users
add_filter( 'user_contactmethods', 'change_contact_info', 10, 1);
function change_contact_info( $contactmethods ) {
$contactmethods['website_title'] = 'Website Title';
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
$contactmethods['linkedin'] = 'Linked In';
return $contactmethods;