Skip to content

Instantly share code, notes, and snippets.

@rosshanney
rosshanney / gce-async-content-tooltips.php
Created February 10, 2013 10:13
Ensure GCE tooltips work with async content
<?php
/*
Plugin name: Ensure GCE tooltips work with async content
*/
function gce_async_content_tooltips() {
?>
<script type="text/javascript">
jQuery(document).ajaxSuccess(function(){
if(typeof gce_tooltips == 'function'){
@rosshanney
rosshanney / gce-shortcode-month-year.php
Created February 1, 2013 20:38
Add month and year parameters to GCE shortcode
<?php
/*
Plugin name: Add month and year parameters to GCE shortcode
*/
function gce_shortcode_month_year( $atts ) {
$options = get_option( GCE_OPTIONS_NAME );
//Check that any feeds have been added
if ( is_array( $options ) && ! empty( $options ) ) {
@rosshanney
rosshanney / gce-qtranslate.php
Last active December 11, 2015 23:18
Allow qTranslate to work on GCE Ajax calls
<?php
/*
Plugin name: Allow qTranslate to work on GCE Ajax calls
*/
function gce_qtranslate() {
if ( function_exists( 'qtrans_getLanguage' ) ) {
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array(
'ajaxurl' => admin_url( 'admin-ajax.php?lang=' . qtrans_getLanguage(), is_ssl() ? 'https' : 'http' ),
@rosshanney
rosshanney / gce-replace-jquery-ui.php
Last active December 11, 2015 11:59
Replace old version of jQuery UI with latest version
<?php
/*
Plugin name: Replace old version of jQuery UI with latest version
*/
function gce_replace_jquery_ui() {
wp_deregister_script( 'jquery-ui' );
wp_register_script( 'jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js', array( 'jquery' ) );
wp_enqueue_script( 'jquery-ui' );
}
@rosshanney
rosshanney / gce-replace-jquery-ui.php
Created January 19, 2013 11:16
Replace theme jQuery UI with WP version
<?php
/*
Plugin name: Replace theme jQuery UI with WP version
*/
function gce_remove_truethemes_jquery_ui() {
if ( ! is_admin() )
wp_deregister_script( 'jquery-ui' );
}
@rosshanney
rosshanney / gce-include-jquery-migrate.php
Last active December 11, 2015 06:19
Include jQuery migrate script
<?php
/*
Plugin name: Include jQuery migrate script
*/
function gce_include_jquery_migrate() {
wp_enqueue_script( 'jquery-migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'gce_include_jquery_migrate' );
@rosshanney
rosshanney / gce-expand-event-info.php
Last active December 10, 2015 21:38
Expand event details on click
<?php
/*
Plugin name: Expand event details on click
*/
function gce_expand_event_info_css() {
if ( defined( 'GCE_VERSION' ) ) {
?>
<style type="text/css">.gce-hidden{display:none;}.gce-event-title{cursor:pointer;}</style>
<?php
@rosshanney
rosshanney / gce-hardcode-ajax-url.php
Created January 7, 2013 19:20
Attempt to work around IE Ajax issue by hardcoding Ajax URL.
<?php
/*
Plugin name: Hardcode AJAX URL for Google Calendar Events
*/
function gce_hardcode_ajax_url() {
if ( defined( 'GCE_GENERAL_OPTIONS_NAME' ) ) {
$options = get_option( GCE_GENERAL_OPTIONS_NAME );
wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array(
<?php
function my_recent_posts_shortcode( $atts ) {
extract( shortcode_atts( array( 'limit' => 5, 'categories' => '' ), $atts ) );
$q = new WP_Query( 'posts_per_page=' . $limit . '&category_name=' . $categories );
$list = '<ul class="recent-posts">';
while ( $q->have_posts() ) {
$q->the_post();
@rosshanney
rosshanney / gce-remove-extra-jquery-ui.php
Created January 3, 2013 15:57
Remove extra jQuery UI added by "TheThe Tabs and Accordions" plugin
<?php
/*
Plugin name: Remove extra jQuery UI added by "TheThe Tabs and Accordions"
*/
function gce_remove_extra_jquery_ui() {
wp_dequeue_script( 'jquery-ui' );
}
add_action( 'wp_print_scripts', 'gce_remove_extra_jquery_ui', 99 );