Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
(function($) {
/*
* render_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0
@JiveDig
JiveDig / multiple_pricing.php
Last active September 10, 2015 15:51
This is an updated version of EDD's FES multiple pricing field (beta 2.3). It adds some filters to allow developers to add new columns to the pricing rows. Also, rewrites some of the code in the `if ( $post_id ) {` section of the render_field_frontend() function.
<?php
class FES_Multiple_Pricing_Field extends FES_Field {
/** @var bool For 3rd parameter of get_post/user_meta */
public $single = false;
/** @var array Supports are things that are the same for all fields of a field type. Like whether or not a field type supports jQuery Phoenix. Stored in obj, not db. */
public $supports = array(
'multiple' => false,
'forms' => array(
@JiveDig
JiveDig / caldera-edit-post-form.php
Last active October 19, 2015 16:13
Creates a shortcode to conditionally display a form if the current user is the author of the post they're trying to edit.
<?php
/**
* Shortcode to conditionally display a post edit form
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @uses Caldera Forms
* @return mixed Access message or Caldera Form
*/
add_shortcode( 'edit_post', 'tsm_do_caldera_edit_post_form' );
@JiveDig
JiveDig / show_post_terms.php
Created September 2, 2014 19:33
Show post terms with links - get_the_term_list
<?php
$language = wp_get_post_terms($post->ID, 'ft_language');
if( $language ) {
echo get_the_term_list( $post->ID, 'ft_language', '<li><span class="detail">Languages:</span>', ', ', '</li>' );
}
@JiveDig
JiveDig / child-pages-acf-map.php
Last active November 12, 2015 21:39
Create shortcode to display map of all child page locations
<?php // Put this code in functions.php or a custom plugin. Don't include opening php tag
/**
* Create shortcode to display map of all child page locations
*
* @author Mike Hemberger
* @link http://thestizmedia.com/shortcode-to-show-map-markers-of-child-pages-with-acf-pro/
*
* @return mixed
*/
@JiveDig
JiveDig / Create new plugin
Last active December 17, 2015 04:19
Create new plugin in WordPress.
<?php
/*
Plugin Name: CUSTOM - Website Title
Plugin URI: http://thestizmedia.com
Description: All custom funtionality for www.Website_Title_Here.com
Version: 1.0
Author: JiveDig
Author URI: http://thestizmedia.com
Copyright 2013 JiveDig (mike@thestizmedia.com)
*/
@JiveDig
JiveDig / Child theme start
Last active December 17, 2015 04:19
The beginning code for a child theme functions.php file
<?php
/**
* Functions
* @package The Stiz Media
* @author JiveDig <mike@thestizmedia.com>
* @copyright Copyright (c) 2013, The Stiz
*/
// Start the engine
require_once( get_template_directory() . '/lib/init.php' );
@JiveDig
JiveDig / EDD Rename 'downloads'.php
Created May 9, 2013 19:41
Easy Digital Downloads (EDD) - Rename downloads title to something else. Custom post type remains 'download'.
// Change labels to "Tracks"
add_filter('edd_download_labels', 'set_download_labels');
function set_download_labels($labels) {
$labels = array(
'name' => _x('Tracks', 'post type general name', 'your-domain'),
'singular_name' => _x('Track', 'post type singular name', 'your-domain'),
'add_new' => __('Add New', 'your-domain'),
'add_new_item' => __('Add New Track', 'your-domain'),
'edit_item' => __('Edit Track', 'your-domain'),
'new_item' => __('New Track', 'your-domain'),
@JiveDig
JiveDig / add_structural_wraps.php
Created May 9, 2013 19:30
Add support for structural wraps
<?php
//* Add support for structural wraps
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'inner',
'footer-widgets',
'footer'
@JiveDig
JiveDig / Register custom post type
Last active December 17, 2015 04:19
Register custom post type, with Videos as the example
<?php
// Register 'Videos' Post Type
if ( ! function_exists('jivedig_videos_post_type') ) {
function jivedig_videos_post_type() {
$labels = array(
'name' => _x( 'Videos', 'executive' ),
'singular_name' => _x( 'Video', 'executive' ),
'menu_name' => __( 'Videos', 'executive' ),
'parent_item_colon' => __( 'Parent Video:', 'executive' ),