Skip to content

Instantly share code, notes, and snippets.

View mikeschinkel's full-sized avatar

Mike Schinkel mikeschinkel

View GitHub Profile
<?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:
<?php
/*
Plugin Name: Taxonomy Mirrored Posts
Description: Enables PHP/Theme Developers to register post types that will use Taxonomy Terms to Mirror Posts.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
/*
* TODD: Need to delete _mirrored_term_id when a post is deleted.
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
/*
Plugin Name: WP Comments by Post Type
Description: Enables PHP Developers to filter the comment admin at edit-comments.php by post type using a $_GET parameter. Use the "comment_admin_menu_post_types" hook to filter the array of post_type names to limit the admin menus that get a "Comments" option.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com/custom-wordpress/plugins
*/
add_action('query', 'hook_to_filter_comment_admin_by_post_type');
function hook_to_filter_comment_admin_by_post_type($sql) {
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
<?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
*/
<?php
/*
Description: Adds a taxonomy filter in the admin list page for a custom post type.
Written for: http://wordpress.stackexchange.com/posts/582/
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps...
*/
add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list');
function add_businesses_column_to_listing_list( $posts_columns ) {
if (!isset($posts_columns['author'])) {
<?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/
*/