Skip to content

Instantly share code, notes, and snippets.

View joshuadavidnelson's full-sized avatar

Joshua Nelson joshuadavidnelson

View GitHub Profile
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
@joshuadavidnelson
joshuadavidnelson / style.css
Created September 18, 2014 20:13
Style for complex helper text in gravity form
div.gform_wrapper .ginput_complex label {
font-size: 14px;
font-style: italic;
color: #a1a1a1;
padding-left: 5px;
}
@joshuadavidnelson
joshuadavidnelson / remove-from-series.php
Created September 25, 2014 16:49
Option to remove a post from a recurring event series in BE-Events-Calendar
<?php
/**
* Add the ability to remove a single event from a series with a checkbox (using CMB for metaboxes)
*
* Uses Bill Erickon's BE-Events-Calendar, however this example uses Custom Metaboxes & Fields (CMB) for the events meta options
*
* @author Joshua David Nelson
*/
// Remove event from series
add_filter( 'soliloquy_fc_query_args', 'rover_save_soliloquy_query', 1, 3 );
function rover_save_soliloquy_query( $query_args, $id, $data ) {
// Only show posts with featured images
$query_args['meta_query'] = array(
array(
'key' => '_thumbnail_id',
)
);
return $query_args;
@joshuadavidnelson
joshuadavidnelson / custom-taxonomy-fields.php
Last active August 29, 2015 14:07 — forked from mikeschinkel/gist:503778
Custom Taxonomy Fields
<?php
/*
* Example code showing how to hook WordPress to add fields to the taxonomny term edit screen.
*
* This example is meant to show how, not to be a drop in example.
*
* This example was written in response to this question:
*
* http://lists.automattic.com/pipermail/wp-hackers/2010-August/033671.html
*
@joshuadavidnelson
joshuadavidnelson / remove-tax-meta.php
Created October 16, 2014 06:37
Remove Genesis Taxonomy Meta
<?php
/**
* Remove taxonomy meta from genesis themes
*
* @author Joshua David Nelson
*/
// Remove Taxonomy Options (Title and Description)
add_action( 'admin_init', 'genesis_add_taxonomy_archive_options' );
@joshuadavidnelson
joshuadavidnelson / move-archive-info.php
Created October 16, 2014 06:39
Place archive title and description above the content wrap in Genesis theme
<?php
// Move page title on taxonomy pages
add_action( 'genesis_meta', 'jdn_move_category_title' );
function jdn_move_category_title() {
if( is_archive() ) {
// Remove the default location for the breadcrumbs and taxonomy title-description
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
// Place the title-descript above the wrap
@joshuadavidnelson
joshuadavidnelson / set-genesis-theme-options.php
Last active August 29, 2015 14:07
Override and set Genesis Theme Options with php
<?php
/**
* Set Genesis Theme Options programatically
*
* @author Joshua David Nelson
*/
/**
* Information Metabox Options
*/
@joshuadavidnelson
joshuadavidnelson / functions.php
Created December 5, 2014 14:57
Add custom query variable
<?php
/**
* Add to your theme functions file
*/
// Add query variable
add_filter( 'query_vars', 'jdn_add_query_vars' );
function jdn_add_query_vars( $vars ){
$vars[] = "yr";
return $vars;
<?php
/**
* Custom Query for custom archive page
* See: http://www.billerickson.net/code/wp_query-arguments/
*/
function jdn_custom_query() {
$args = array(
'posts_per_page' => 7,
'post_type' => 'post',
'orderby' => 'date',