Skip to content

Instantly share code, notes, and snippets.

@rosshanney
rosshanney / gce-remove-qtip.php
Created December 4, 2012 20:52
Removes GCE tooltip functionality
<?php
/*
Plugin name: Remove GCE tooltip functionality
*/
function gce_remove_qtip() {
wp_dequeue_script( 'gce_jquery_qtip' );
}
add_action( 'wp_enqueue_scripts', 'gce_remove_qtip', 99 );
@rosshanney
rosshanney / gce-allow-id-on-div.php
Created December 24, 2012 15:15
Allows id attribute on div tags
<?php
/*
Plugin name: Allow id attribute on div tags
*/
function gce_allow_id_on_div() {
global $allowedposttags;
$allowedposttags['div']['id'] = true;
}
@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 );
<?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-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(
@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-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-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-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-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' ),