Skip to content

Instantly share code, notes, and snippets.

View mikeschinkel's full-sized avatar

Mike Schinkel mikeschinkel

View GitHub Profile
<?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:
*
<?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:
/*
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
<?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
<?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.
*
<?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:
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
<?php
/*
* See: http://wordpress.stackexchange.com/questions/859/
*
*/
include "wp-load.php";
echo 'Jump to:';
echo get_page_selector('My Select Menu');
<?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/
*/
<?php
/**
* Plugin Name: WP Boilerplate Shortcode
* Description: Provides a boilerplate post type and a shortcode for insertion into posts, pages and custom post types Requires WP >= v3.0.
* Plugin URI: http://mikeschinkel.com/wordpress-plugins/wp-boilerplate-shortcode/
* Version: 1.0.4
* Author: Mike Schinkel
* Author URI: http://mikeschinkel.com/wordpress-plugins/
*/