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: Mingle - Users - Online (example) | |
Description: Requires WP-UserOnline to be installed | |
*/ | |
function mingle_linked_names( $name, $user ) { | |
if ( !$user->user_id ) { | |
return $name; | |
} |
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
# Upstream to abstract backend connection(s) for php | |
upstream php { | |
server unix:/tmp/php-cgi.socket; | |
server 127.0.0.1:9000; | |
} | |
server { | |
server_name example.com; | |
root /var/www; |
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 | |
function debug_query() { | |
add_filter('the_posts', '_debug_query', 10, 2); | |
} | |
function _debug_query($posts, $wp_query) { | |
remove_filter( current_filter(), __FUNCTION__, 10, 2 ); | |
debug( $wp_query->request ); |
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 | |
/** | |
* @param string $tag The hook name | |
*/ | |
function debug_filters( $tag = false ) { | |
global $wp_filter; | |
if ( $tag ) { | |
$hook[ $tag ] = $wp_filter[ $tag ]; |
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 | |
// Register the post type and taxonomy | |
function init_product_cpt() { | |
register_post_type( 'product', array( | |
'public' => true, | |
'label' => __( 'Products', 'my-plugin' ) | |
) ); | |
register_taxonomy( 'color', 'product', array( |
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: Compare WP_Query SQL | |
Version: 1.0 | |
Description: Compare SQL generated by WP_Query between WordPress versions. | |
Author: scribu | |
Author URI: http://scribu.net/ | |
Copyright (C) 2011 Cristi Burcă (scribu@gmail.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
if(!jQuery('<input PLACEHOLDER="1" />')[0].placeholder){ //Uppercase attr for IE | |
jQuery(':input[placeholder]').each(function(){ | |
var $this = $(this); | |
if(!$this.val()){ | |
$this.val($this.attr('placeholder')); | |
$this.addClass('input-placeholder'); | |
} | |
}).live('focus', function(e){ | |
var $this = $(this); | |
if($this.hasClass('input-placeholder')){ |
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 | |
/* | |
Script Name: Wordpress Hooks & Filters Flow | |
Plugin URI: http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/ | |
Description: Lists hooks and their associated filters/actions for your blog. Meant to provide debugging help. | |
Version: 1.0 | |
Author: Ozh | |
Author URI: http://planetOzh.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 | |
/* | |
Plugin Name: Unit Test: Query Flags | |
Description: Drop into mu-plugins folder and go to the front page | |
Author: scribu | |
Version: 1.0 | |
*/ | |
class Unit_Query_Flags { |
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 | |
// Register the column | |
function price_column_register( $columns ) { | |
$columns['price'] = __( 'Price', 'my-plugin' ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-post_columns', 'price_column_register' ); |