PhpStorm now bundles WordPress coding style natively, starting from version 8.
- Go to
Project Settings>Code Style>PHP. - Select
Set From...(top right of window) >Predefined Style>WordPress.
No longer need to muck with this import! :)
| <?php | |
| // @link http://books.google.com/books?id=fvA7zLEFWZgC&pg=PA61&lpg=PA61#v=onepage&q&f=false | |
| function nice_labels( $min, $max, $ticks = 5 ) { | |
| $range = nice_number( $max, false ); | |
| $d = nice_number( $range / ( $ticks - 1 ) ); | |
| $graphmin = floor( $min / $d ) * $d; | |
| $graphmax = ceil( $max / $d ) * $d; | |
| $nfrac = max( array( - floor( log( $d, 10 ) ), 0 ) ); |
| <?php | |
| /* | |
| Plugin Name: R Debug | |
| Description: Set of dump helpers for debug. | |
| Author: Andrey "Rarst" Savchenko | |
| Author URI: https://www.rarst.net/ | |
| License: MIT | |
| */ |
| <?php | |
| function is_user_logged_in() { | |
| $loggedin = false; | |
| foreach ( (array) $_COOKIE as $cookie => $value ) { | |
| if ( stristr($cookie, 'wordpress_logged_in_') ) | |
| $loggedin = true; | |
| } | |
| return $loggedin; | |
| } | |
| if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && ! is_user_logged_in() ) |
| // Logo | |
| // http://wordpress.org/about/logos/ | |
| @wp_logo_blue: #21759B; | |
| @wp_logo_orange: #D54E21; | |
| @wp_logo_grey: #464646; | |
| // Admin | |
| // http://dotorgstyleguide.wordpress.com/outline/colors/ |
| <?php | |
| Oh_Shuddup::on_load( array( 'get_theme_data' ) ); | |
| /** | |
| * Shuts up deprecated messages for specific functions. | |
| */ | |
| class Oh_Shuddup { | |
| static $functions; |
| <?php | |
| set_error_handler( 'backtrace_error_handler', error_reporting() ); | |
| function backtrace_error_handler( $errno, $errstr, $errfile, $errline, $errcontext ) { | |
| // handle @ | |
| if( 0 === error_reporting() ) | |
| return false; |
| <?php | |
| /* | |
| Plugin Name: Disable plugins when doing local dev | |
| Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
| Version: 0.1 | |
| License: GPL version 2 or any later version | |
| Author: Mark Jaquith | |
| Author URI: http://coveredwebservices.com/ | |
| */ |
| <?php | |
| add_action( 'loop_start', 'mark_posts_with_query' ); | |
| function mark_posts_with_query( $query ) { | |
| $in_main_query = $query->is_main_query(); | |
| foreach ( $query->posts as $post ) { | |