This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
orphaned-post-types.php | |
View the list at http://yoursite.com/wp-admin/edit.php?orphans=true | |
In response to: http://lists.automattic.com/pipermail/wp-hackers/2010-November/035682.html | |
Not yet complete. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Admin Parse Output | |
Description: Adds a 'admin_parse_output' hook to allow you to parse and modify the HTML generated by the admin when other hooks are not available. Starts HTML capture with the 'admin_init' hook and ends with the 'admin_footer' hook so it will miss anything that comes after 'admin_footer' (see the last lines of /wp-admin/admin-footer.php to see what this hook will miss.) | |
Version: 0.1 | |
Author: Mike Schinkel | |
Author URI: http://mikeschinkel.com | |
Notes: Written for http://lists.automattic.com/pipermail/wp-hackers/2010-November/036150.html | |
Example Usage: See https://gist.github.com/717515 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
functions.php - Plugin that this example uses: https://gist.github.com/717514 | |
*/ | |
add_action('admin_parse_output', 'yoursite_admin_parse_output'); | |
function yoursite_admin_parse_output($html) { | |
global $pagenow; | |
if ($pagenow=='themes.php' && isset($_GET['page']) && $_GET['page']=='custom-header') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This approach is what Andrew Nacin suggested[1] instead of [2] and requested via email by Steve Wolfson. | |
* Given it's complexity I can't advise te use of [1] and still recomment [2]. See also: [3][4]. | |
* | |
* Author: Mike Schinkel (http://mikeschinkel.com) | |
* | |
* [1] http://lists.automattic.com/pipermail/wp-hackers/2010-November/036172.html | |
* [2] http://lists.automattic.com/pipermail/wp-hackers/2010-November/036170.html | |
* [3] https://gist.github.com/717514 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Creates JSON class for Tom C. Barrett to load tickets via a RESTful API: | |
* | |
* @example: | |
* | |
* URL: http://example.com/api/ticket/12345 | |
* | |
* @see: | |
* |