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 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 wp-active-plugins.php
<?php
/*
PHP command-line shell script to access the WordPress database and print out the list of active plugins.
SYNTAX:
php wp-active-plugins.php $host $db $user $pw
For example:
View gist:508914
Which performs better (in general) and why in a PHP app (WordPress) across many different potential web hosting scenarios?
The code is obviously psuedo-code mixing MYSQL+PHP. Reply via gmail to mikeschinkel.
1.)
$slug = 'actor'
SELECT p.post_title FROM wp_posts p
INNER JOIN wp_term_relationships tr ON p.ID=tr.object_id
INNER JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id=tt.term_taxonomy_id
View wp-active-plugins-data.php
<?php
/*
Plugin Name: WP Active Plugins Data
Plugin URI: http://mikeschinkel.com/wordpress-plugins/wp-active-plugins-data/
Description: Loads Plugin Data on Plugin Activation and Persists to wp_options for quick retrieval.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
Note: Written for http://wordpress.stackexchange.com/questions/361/is-there-a-way-for-a-plug-in-to-get-its-own-version-number
*/
View test.php
<?php
/*
* See: http://wordpress.stackexchange.com/questions/859/
*
*/
include "wp-load.php";
echo 'Jump to:';
echo get_page_selector('My Select Menu');
View special-background.php
<?php
/*
Plugin Name: Special Background
Plugin URI: http://wordpress.stackexchange.com/questions/972/
Description: Example to show how to add a special background using exiting background admin page in core.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com/custom-wordpress-plugins/
*/
You can’t perform that action at this time.