Skip to content

Instantly share code, notes, and snippets.

View media317's full-sized avatar

Alan Smith media317

View GitHub Profile
@media317
media317 / Woo to DonorPro
Created July 22, 2014 01:00
Hopegivers WooCommerce to DonorPro
//* Send information to DonorPro
add_action( 'woocommerce_order_status_completed', 'hope_donor', 1, 5 );
/*
* Do something after WooCommerce sets an order on completed
*/
function hope_donor($user_id, $new_order, $paykey, $fields, $source) {
$order = new ID_Member_Order($new_order);
$the_order = $order->get_order();
if (!empty($the_order)) {
$price = $the_order->price;
@media317
media317 / CCN comments
Created October 25, 2014 23:38
custom commment issues
function custom_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
<div class="comment-author vcard"><?php commenter_link() ?></div>
<div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span>', 'hbd-theme'),
get_comment_date(),
get_comment_time(),
'#comment-' . get_comment_ID() );
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@media317
media317 / category loop
Last active August 29, 2015 14:08
Attempting to create a WordPress Loop that pulls the category slug from the custom field value of key cbc_category. The loop will pull all post with the category in the value of the custom field and display the featured image, title and excerpt.
// Add our custom loop
add_action( 'genesis_after_entry_content', 'media317_cat_loop' );
function media317_cat_loop() {
$cbccategory = genesis_get_custom_field('cbc_category');
$args = array(
'category_name' => $cbccategory,
'orderby' => 'post_date',
<?php
/**
* The template used for displaying page content in page.php
*
* @package AppPresser Theme
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@media317
media317 / Custom Post Type Loop
Created March 11, 2014 20:34
Conditional tag with Custom Post Type and Custom Taxonomy
//* Custom Genesis Loop
remove_action ( 'genesis_loop', 'genesis_do_loop' );
add_action ( 'genesis_loop', 'cbc_custom_loop' );
function cbc_custom_loop() {
if (has_term('custodial')) {
echo '<h1>';
echo the_title();
echo '</h1>';
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>get_title</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="childtheme/style.css">
<link rel="shortcut icon" href="childtheme/images/favicon.ico">
@media317
media317 / gist:4632494
Created January 25, 2013 07:27
Genesis 1.9.1 Loop. Not working???!!
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_before_loop', 'child_maybe_do_grid_loop' );
function child_maybe_do_grid_loop() {
// Amend this conditional to pick where this grid looping occurs
if ( is_page('bbtestpage') ) {
remove_action('genesis_before_post_content', 'genesis_post_info');
@media317
media317 / Custom Stylesheet TinyMCE
Created February 7, 2013 18:24
Custom style sheet for the TinyMCE Visual Editor in Wordpress
/** Add Editor Styles within a WP Child theme*/
add_editor_style(); //This will use the default styles of your child theme stylesheet.
/** Add Editor Styles for WP Themes */
add_editor_style( 'custom-editor-style.css' );
@media317
media317 / gist:5085350
Last active December 14, 2015 12:18
Add custom Avatar to WordPress install.
// Add a default avatar to Settings > Discussion
if ( !function_exists('media317_addgravatar') ) {
function media317_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('stylesheet_directory') . '/images/avatar.jpg'; // Make sure to add the images directory to theme
$avatar_defaults[$myavatar] = 'Media317'; //Add a default name for the Avatar
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fb_addgravatar' );