This file contains hidden or 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' ); |
This file contains hidden or 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 hidden or 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 | |
| // Forked from: http://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235 | |
| function process_error_backtrace($errno, $errstr, $errfile, $errline) { | |
| if(!(error_reporting() & $errno)) | |
| return; | |
| switch($errno) { | |
| case E_WARNING : | |
| case E_USER_WARNING : | |
| case E_STRICT : |
This file contains hidden or 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 | |
| # http://scribu.net/blog/defaultdict-in-php.html | |
| class Defaultdict implements ArrayAccess { | |
| private $container = array(); | |
| private $default; | |
| public function __construct( $default ) { |
This file contains hidden or 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 | |
| /** | |
| * Iterates over results of a query, split into many queries via LIMIT and OFFSET | |
| */ | |
| class QueryIterator implements Iterator { | |
| var $limit = 500; | |
| var $query = ''; | |
| var $global_index = 0; |
This file contains hidden or 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 hidden or 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
| # site path: /var/www/wp.dev/ | |
| # wp path: /var/www/wp.dev/core/ | |
| # site url: http://wp.dev/core/ | |
| # wp url: http://wp.dev/core/ | |
| upstream php { | |
| server unix:/var/run/phpfpm.sock; | |
| } |
This file contains hidden or 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 | |
| # License: Public Domain | |
| # I recommend replacing 'my_' with your own prefix. | |
| function my_template_path() { | |
| return My_Wrapping::$main_template; | |
| } |
This file contains hidden or 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 | |
| /** | |
| * Insert an array into another array before/after a certain key | |
| * | |
| * @param array $array The initial array | |
| * @param array $pairs The array to insert | |
| * @param string $key The certain key | |
| * @param string $position Wether to insert the array before or after the key | |
| * @return array |
This file contains hidden or 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
| from collections import defaultdict | |
| def male_without_match(matches, males): | |
| for male in males: | |
| if male not in matches: | |
| return male | |
| def deferred_acceptance(male_prefs, female_prefs): | |
| female_queue = defaultdict(int) |
NewerOlder