Skip to content

Instantly share code, notes, and snippets.

@rosshanney
rosshanney / gce-expand-list.php
Created October 2, 2012 20:51
Expand GCE widget lists
<?php
/*
Plugin name: Expand GCE List
*/
function gce_expand() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.gce-widget-list').find('.gce-list>li:gt(2)').hide();
@rosshanney
rosshanney / gce-fix-ajax-error.php
Created October 3, 2012 21:03
Hopefully fixes an Ajax error
<?php
/*
Plugin name: Fix GCE Ajax error
*/
function gce_fix_ajax_error() {
global $wp_scripts;
if ( isset( $wp_scripts->registered['gce_scripts']->extra['data'] ) ) {
$wp_scripts->registered['gce_scripts']->extra['data'] = str_replace( 'https', 'http', $wp_scripts->registered['gce_scripts']->extra['data'] );
@rosshanney
rosshanney / gce-newer-jquery-ui.php
Created October 4, 2012 18:51
Load jQuery 1.8.23 rather than 1.8.20
<?php
/*
Plugin name: GCE newer jQuery UI
*/
function gce_newer_jquery_ui() {
wp_deregister_script( 'jquery-ui-core' );
wp_register_script( 'jquery-ui-core', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js' );
wp_enqueue_script( 'jquery-ui-core' );
}
@rosshanney
rosshanney / gce-ajax-fix.php
Created October 9, 2012 18:41
GCE Asynchronous Content Loading Fix
<?php
/*
Plugin name: GCE Asynchronous Content Loading Fix
*/
function gce_ajax_fix() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
if(typeof(gce_tooltips) === 'function'){
@rosshanney
rosshanney / gce-updated-shortcode.php
Created October 17, 2012 21:29
Adds year / month params to [google-calendar-events] shortcode
//Handles the shortcode stuff
function shortcode_handler( $atts ) {
$options = get_option( GCE_OPTIONS_NAME );
//Check that any feeds have been added
if ( is_array( $options ) && ! empty( $options ) ) {
extract( shortcode_atts( array(
'id' => '',
'type' => 'grid',
'title' => null,
@rosshanney
rosshanney / gce-allow-class-on-i.php
Created October 24, 2012 17:30
Allow class attribute on i tags
<?php
/*
Plugin name: Allow class attribute on i tags
*/
function gce_allow_class_on_i() {
global $allowedposttags;
$allowedposttags['i']['class'] = true;
}
@rosshanney
rosshanney / gce-parser.php
Created November 16, 2012 21:54
Modified version of gce-parser.php that groups events within each day by feed, then by start time
<?php
class GCE_Parser {
private $feeds = array();
private $merged_feed_data = array();
private $errors = array();
private $title = null;
private $max_events_display = 0;
private $start_of_week = 0;
private $sort_order = 'asc';
@rosshanney
rosshanney / gce-check-upcoming.php
Created November 28, 2012 19:47
Check if a feed has events
<?php
function gce_check_upcoming() {
$events = get_transient( 'gce_feed_1' );
if ( ! empty( $events ) ) {
// there are upcoming events
}
}
add_action( 'init', 'gce_check_upcoming' );
@rosshanney
rosshanney / gce-newer-jquery-ui.php
Created December 1, 2012 11:17
Loads latest version of jQuery UI to replace old version loaded by "Total Control HTML5 Audio Player Basic"
<?php
/*
Plugin name: Load newer version of jQuery UI
*/
function gce_load_newer_jquery_ui() {
wp_deregister_script( 'jquery-ui-base' );
wp_register_script( 'jquery-ui-base', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js' );
wp_enqueue_script( 'jquery-ui-base' );
}
@rosshanney
rosshanney / gce-allow-input-tags.php
Created December 3, 2012 21:15
Allow input tags
<?php
/*
Plugin name: Allow input tags
*/
function gce_allow_input_tags() {
global $allowedposttags;
$allowedposttags['input'] = array(
'type' => true,