Skip to content

Instantly share code, notes, and snippets.

@cdils
cdils / archive-testimonials-grid.php
Last active April 25, 2018 16:08 — 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.
<?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
@cdils
cdils / gist:5430275
Last active December 16, 2015 11:49 — forked from billerickson/gist:1535891
Change the sort order for an archive template by a custom field.
<?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
*
*/
<?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 / 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>
<?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 / 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 / 0_reuse_code.js
Created January 31, 2014 15:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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 / 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 / wpmdbpro-cli-remote-backup-script.sh
Last active October 25, 2022 19:21 — forked from JRGould/wpmdbpro-cli-remote-backup-script.sh
WP Migrate DB Pro CLI Backup Script
#!/bin/bash
#
# Declare SITES as an associative array
declare -A SITES
# Format: SITES[WPMDB profile number]=backup_filename_base
SITES[1]=remote_backup_com
#SITES[2]=another_site_to_backup
#SITES[3]=my_other_blog
## These variables will be specific to the WordPress