Skip to content

Instantly share code, notes, and snippets.

@cdils
cdils / functions.php
Created September 15, 2014 18:34
Hook site avatar before site title
//* Hook site avatar before site title
add_action( 'genesis_header', 'sixteen_nine_site_gravatar', 5 );
function sixteen_nine_site_gravatar() {
$header_image = get_header_image() ? '<img alt="" src="' . get_header_image() . '" />' : get_avatar( get_option( 'admin_email' ), 224 );
printf( '<div class="site-avatar"><a href="%s">%s</a></div>', home_url( '/' ), $header_image );
}
@cdils
cdils / functions.php
Created July 21, 2014 13:26
Genesis Pagination stuff
<?php //remove this entire line
// Use this to completely remove pagination on archive pages
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
@cdils
cdils / remove-post-details.php
Created May 26, 2014 17:09
Remove post info and post meta from some custom post type pages.
<?php //remove this entire line with opening tag
//Remove post info and post meta on custom post types
add_action ( 'get_header', 'cd_remove_post_details');
function cd_remove_post_details() {
if ( is_singular( array( 'press', 'filmmaker' ) ) ) {
remove_action ( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action ( 'genesis_entry_footer', 'genesis_post_meta' );
@cdils
cdils / Customize the Contact Info Fields in WordPress Profiles 6
Last active August 29, 2015 14:01
Add custom contact fields in the WordPress User Edit screen.
// 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 / author-post-info.php
Last active August 29, 2015 14:01
Two methods to add post author avatar to entry header
<?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 / simple-social-icons.php
Created May 1, 2014 20:44
Pre-load styles for simple social icons
// 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 / functions.php
Last active May 18, 2018 01:49 — forked from srikat/functions.php
Add widget area (with Simple Socian Icons) to primary navigation.
<?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 / prev_next_page.php
Created April 11, 2014 14:35
Add Previous/Next pagination to single posts within a category. If there are no adjacent posts, don't display anything.
<? php //remove this line
// Adding pagination before and after post entry in Genesis Framework
add_action( 'genesis_before_entry', 'cd_prev_next_posts_nav' );
add_action( 'genesis_after_entry', 'cd_prev_next_posts_nav' );
// Add Prev/Next post navigation within a single category
function cd_prev_next_posts_nav() {
// Check to see if there are previous and next posts
@cdils
cdils / post_nav.php
Created April 8, 2014 15:12
Add (in category) post navigation to the bottom of single posts and throw some Genesis styles around it.
<? //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 / embed-form.php
Last active May 29, 2019 14:28
Add a Gravity Forms to a single AgentPress Listings post and dynamically populate the form with the post title. Add this to functions.php.
<?php //remove this line
/**
* Enqueue scripts for a specified Gravity Form (13 = ID) and then
* embed Gravity Form at the bottom of single property listings
*
* http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts
* http://www.gravityhelp.com/documentation/page/Embedding_A_Form#Function_Call
*
* @author Carrie Dils