Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
@jkudish
jkudish / optimizely.php
Created March 27, 2012 23:49 — forked from evansolomon/optimizely.php
WordPress.com plugin for running Optimizely experiments
<?php
/*
Plugin Name: Optimizely
Description: Runs Optimizely experiments.
Author: koop, evansolomon
Version: 0.2
*/
class WPCOM_Optimizely {
public $version;
@jkudish
jkudish / gist:2269675
Created March 31, 2012 23:28 — forked from andoodle/gist:2269674
mediawiki google analytics plugin
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'Google Analytics Integration',
'version' => '2.0.2',
'author' => 'Tim Laqua',
@jkudish
jkudish / gist.css
Created June 3, 2012 22:19 — forked from tollmanz/gist.css
Add Cacheable Gists to Your WordPress Site
.gist {
color: #e4322e;
}
.gistdiv {
padding: 0;
margin: 0;
}
.gist .gist-file {
@jkudish
jkudish / emailshortcode.php
Created December 7, 2012 17:52 — forked from robertdall/emailshortcode.php
Email Short Code
<?php
// Hide Email from Spam Bots
function cwc_mail_shortcode( $atts , $content = null ) {
if ( ! is_email( $content ) )
return;
for ( $i = 0; $i < strlen( $content ); $i++ )
$encodedmail .= "&#" . ord( $content[$i] ) . ';';
return '<a href="' . esc_url( 'mailto:' . $encodedmail ) . '">Email</a>';
<?php
/**
* Notes and things that I changed:
* -- fixed indentation and spacing for WP standards
* -- posts_per_page = -1 is dangerous, what happens if the site has 1000000 posts, the server will explode - find a high but sane limit
*/
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
<?php
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $existing_image ){
global $wpdb;
return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=attachment AND guid=%s", $existing_image ) );
}
$existing_image = "http://guidevoyage.org.dev/wp-content/uploads/2012/02/Fontaine-de-Trevi.jpg";
<?php
require_once dirname( __FILE__ ) . '/wp-load.php';
//$existing_image = 'http://guidevoyage.org.dev' . '/wp-content/uploads/2010/12/122010_0314_LamdinadeSo1.png';
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $full_image_url ){
global $wpdb;