Skip to content

Instantly share code, notes, and snippets.

Thomas Griffin thomasgriffin

Block or report user

Report or block thomasgriffin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1953250
if ( version_compare( PARENT_THEME_VERSION, '1.7.9', '>' ) ) {
include_once( CHILD_DIR . '/lib/admin/admin.php' );
include_once( CHILD_DIR . '/lib/admin/front.php' );
include_once( CHILD_DIR . '/lib/widgets/radio-latest-news-widget.php' );
}
View gist:1980987
<form method="post" class="wl_add_item">
<input type="hidden" name="wl_add_quantity" value="1" />
<input type="hidden" name="wl_add_post_id" value="107" />
<input type="image" title="Increase quantity" src="http://npp-dev.se/hagabergs/wp-content/plugins/wishlist/add.png" value="submit" />
</form>
<form method="post" class="wl_remove_item">
<input type="hidden" name="wl_remove_quantity" value="1" />
<input type="hidden" name="wl_remove_post_id" value="107" />
<input type="image" title="Decrease quantity" src="http://npp-dev.se/hagabergs/wp-content/plugins/wishlist/remove.png" value="submit" />
View gist:1980990
<?php
add_action( 'wp_ajax_myajax-submit', 'tgm_process_ajax' );
add_action( 'wp_ajax_nopriv_myajax-submit', 'tgm_process_ajax' );
function tgm_process_ajax() {
$data = array(
'quantity' => $_POST['wl_quantity'],
'post_id' => $_POST['wl_post_id']
);
View gist:1980991
<?php
add_action( 'wp_ajax_myajax-submit', 'tgm_process_ajax' );
add_action( 'wp_ajax_nopriv_myajax-submit', 'tgm_process_ajax' );
function tgm_process_ajax() {
$data = array(
'quantity' => $_POST['wl_quantity'],
'post_id' => $_POST['wl_post_id']
);
View gist:1980993
jQuery(document).ready(function($) {
$('.wl_add_item, .wl_remove_item').submit(function(e) {
e.preventDefault();
/** Determine if we are adding or removing items and build variables from there */
var current_object = $(this); // Get the current object - we will use it when appending stuff
var action_type = $(this).attr('class');
if ( 'wl_add_item' == action_type ) {
var process_this = 'add';
var quantity = $(this).find('input[name="wl_add_quantity"]').val();
View gist:2240007
$terms = wp_get_object_terms( $post->ID, 'sermon-series' );
$args = array(
'post_type' => 'sermons',
'posts_per_page' => 2,
'tax_query' => array(
array(
'taxonomy' => 'sermon-series',
'field' => 'id',
'terms' => $terms[0]->term_id
)
View gist:2312196
social_tools: '<div class="pp_social"><div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></div>',
View gist:2579484
<?php
global $current_screen;
if ( 'YOUR POST TYPE HERE' == $current_screen->post_type && 'post' == $current_screen->base )
// Do something here
View gist:2605172
$('.theme-hover .thumb').on({
mouseenter: function() {
$(this).parent().parent().find('.preview-image').show();
},
mouseleave: function () {
$(this).parent().parent().find('.preview-image').hide();
}
});
View gist:2788954
<?php
/** Store oEmbed results in a transient */
if ( false === ( $tweets = get_site_transient( 'tgm_get_tweets' ) ) {
$tweets = wp_oembed_get( $url, $args );
if ( ! $tweets ) // wp_oembed_get returns false on failure
$tweets = *get your old tweets from here*;
set_site_transient( 'tgm_get_tweets', $tweets, 60*60*24 );
}
You can’t perform that action at this time.