Skip to content

Instantly share code, notes, and snippets.

View mikeschinkel's full-sized avatar

Mike Schinkel mikeschinkel

View GitHub Profile
<?php
/*
Plugin Name: Eliminate Plugin Clutter
Plugin URI: http://mikeschinkel.com/wordpress-plugins/eliminate-plugin-clutter/
Description: Provides an "Archiving" feature that allows you to clear currently unused plugins from view without having to delete them yet having all of your archived plugins only one "Unarchive" click away.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
/*
@mikeschinkel
mikeschinkel / test-get-comment-replies.php
Created September 23, 2010 20:58
get_comment_replies() function for WordPress with a working example that returns a WordPress comment object for a given comment ID annotated with "reply_count" and "replies" properties.
<?php
/*
* test-get-comment-replies.php
*
* Returns a comment object for a given comment ID annotated with "reply_count" and "replies" properties:
*
* reply_count: count of all replies including sum of child replies.
* replies: array of child comment objects also annotated with "reply_count" and "replies" properties, recursively.
*
* Examples:
<?php
/*
PostsByLatestCommentQuery class that extends WP_Query and sorts posts by latest comment
Author: Mike Schinkel (http://mikeschinkel.com)
Just drop this example into the root of your website and call directly to see it work.
Use the class in your plugins or themes.
See: http://lists.automattic.com/pipermail/wp-hackers/2010-September/035113.html
switch (n)
{
case 0:
echo "You typed zero.";
case 1:
case 4:
case 9:
echo "n is a perfect square.";
case 2:
echo "n is an even number.";
case (n)
{
when 0:
echo "You typed zero.";
when 1:
when 4:
when 9:
echo "n is a perfect square.";
when 2:
echo "n is an even number.";
<?php
/*
* Adds "tax_terms" to WP_Query()
*
* See: http://lists.automattic.com/pipermail/wp-hackers/2010-October/035258.html
*
* Author: Mike Schinkel (http://mikeschinkel.com)
*
*/
<?php
/*
latest-post-per-post-type-query.php
LatestPostPerPostTypeQuery class that extends WP_Query and provides the latest post for each post type passed
Author: Mike Schinkel (http://mikeschinkel.com)
Just drop this example into the root of your website and call directly to see it work.
<?php
/*
blog-from-flickr.php
Allows the WordPress blog owner to blog a recent photo from a Flickr Photoset just by clicking a button.
Author: Mike Schinkel (http://mikeschinkel.com)
Just drop this example into the root of your website and call directly to see it work.
@mikeschinkel
mikeschinkel / wp-post-counts-for-user-by-post-type.php
Created October 24, 2010 07:06
Adds Post Counts by Post Type per User in the User List withing WordPress' Admin console (URL path => /wp-admin/users.php)
<?php
/*
Adds Post Counts by Post Type per User in the User List withing WordPress' Admin console (URL path => /wp-admin/users.php)
Written for: http://wordpress.stackexchange.com/questions/3233/showing-users-post-counts-by-custom-post-type-in-the-admins-user-list
By: Mike Schinkel (http://mikeschinkel.com)
Date: 24 October 2010
*/
@mikeschinkel
mikeschinkel / posts-by-category-with-price.php
Created October 26, 2010 05:58
Query for a list of WordPress posts by category, but only those with a postmeta->meta_key='Price' that's >0 and NOT NULL.
<?php
/*
posts-by-category-with-price.php
Query for a list of WordPress posts by category,
but only those with a postmeta->meta_key='Price' that's >0 and NOT NULL.
Author: Mike Schinkel (http://mikeschinkel.com)