Skip to content

Instantly share code, notes, and snippets.

Mike Schinkel mikeschinkel

Block or report user

Report or block mikeschinkel

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 vimeo-shortcode-for-wordpress-pressthis.php
/*
Makes WordPress' PressThis use vimeo short code instead of <object>/<embed> tags.
Add this to the WordPress theme's function.php file.
Addresses the Vimeo question from StackExchange here:
http://webapps.stackexchange.com/questions/3834/customizing-press-this-quick-posting-for-wordpress
*/
add_action('admin_print_footer_scripts','greatjakes_admin_print_footer_scripts');
function greatjakes_admin_print_footer_scripts() {
if ($_SERVER['PHP_SELF']=='/wp-admin/press-this.php') {
$script=<<<SCRIPT
View wp-all-posts-for-any-term-in-a-taxonomy.php
<?php
/*
wp-all-posts-for-any-term-in-a-taxonomy.php
This is an example showing a hook used to add the ability to use "any" as a term to match all terms for a taxonomy.
It will run as a standalone file in the root of a WordPress 3.0 install with a URL that looks like:
http://example.com/wp-all-posts-for-any-term-in-a-taxonomy.php
It was written to address this question:
@mikeschinkel
mikeschinkel / gist:493178
Created Jul 28, 2010
Sample SQL file to return menu items for a post in WordPress 3.0
View gist:493178
<?php
include "wp-load.php";
$post_id = $_GET['post'];
$menu_id = $_GET['menu'];
global $wpdb;
$result = $wpdb->get_results($wpdb->prepare("SELECT t.term_id as menu_id,
t.name AS menu_name,
View gist:493195
<?php
include "wp-load.php";
$post_id = $_GET['post'];
$menu_id = $_GET['menu'];
$term = get_term($menu_id, 'nav_menu');
$menu_items = new WP_Query(
View gist:498700
<?php
/*
* Example code showing how to hook WordPress 3.0 to allow for querying multiple taxonomies
* Uses two (2) approaches:
*
* 1. A "tax_terms" URL parameter: WP_Query('tax_terms=type:dining,city:mb,package:discounts')
* 2. Taxonomies as URL parameters: WP_Query('type=dining&city=mb&package=discounts')
*
* To try this example:
*
View gist:501033
<?php
/*
* Example code showing how to hook WordPress 3.0 to allow for querying multiple meta_keys.
* It uses this approach for setting criteria where the keys get array indexed (the following
* query will query a hypothetical list of products for those colored Red and sized Large
* and it will sort them in price order:
*
* WP_Query('post_type=product&meta[color]=Red&meta[size]=Large&meta_key=price&orderby=meta_value_num')
*
* To try this example:
View gist:502420
/*
Answer to: http://wpquestions.com/question/show/id/694
By: Mike Schinkel
Handles URL Rewriting in WordPress 3.0 like this:
fastigheter-spanien/X -> property/X&lang=sv
fastigheter-usa/X -> property/X&lang=sv
View gist:502421
<?php
/*
Handles URL Rewriting in WordPress 3.0 like this:
fastigheter-spanien/X -> property/X&lang=sv
fastigheter-usa/X -> property/X&lang=sv
properties-spain/X -> property/X&lang=en
properties-usa/X -> property/X&lang=en
View gist:502677
<?php
/**
* TwentyTen functions and definitions
*
* Sets up the theme and provides some helper functions. Some helper functions
* are used in the theme as custom template tags. Others are attached to action and
* filter hooks in WordPress to change core functionality.
*
View gist:503778
<?php
/*
* Example code showing how to hook WordPress to add fields to the taxonomny term edit screen.
*
* This example is meant to show how, not to be a drop in example.
*
* This example was written in response to this question:
*
* http://lists.automattic.com/pipermail/wp-hackers/2010-August/033671.html
*
You can’t perform that action at this time.