Skip to content

Instantly share code, notes, and snippets.

Avatar

Carrie Dils cdils

View GitHub Profile
@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;
@cdils
cdils / functions.php
Last active May 18, 2018 — forked from srikat/functions.php
Add widget area (with Simple Socian Icons) to primary navigation.
View functions.php
<?php //remove this line
// Register the widget area
genesis_register_sidebar( array(
'id' => 'nav-social-menu',
'name' => __( 'Nav Social Menu', 'your-theme-slug' ),
'description' => __( 'This is the nav social menu section.', 'your-theme-slug' ),
) );
@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 / string-body-class.php
Last active Jan 4, 2016 — 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."
View string-body-class.php
<?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;
}
View disable-self-ping.php
<?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 Dec 30, 2015 — 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.
View full-content-archives-genesis.php
<?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>
View archive-speaking_event.php
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@cdils
cdils / gist:5430275
Last active Dec 16, 2015 — forked from billerickson/gist:1535891
Change the sort order for an archive template by a custom field.
View gist:5430275
<?php
/**
* Change the post order for listings
*
* @author Carrie Dils
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @reference http://codex.wordpress.org/Class_Reference/WP_Query
*
*/
@cdils
cdils / archive-testimonials-grid.php
Last active Apr 25, 2018 — forked from billerickson/grid-loop.php
Use this grid loop in a custom page template to show page content, followed by a loop through a custom post type.
View archive-testimonials-grid.php
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop