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 | |
# License: Public Domain | |
# I recommend replacing 'my_' with your own prefix. | |
function my_template_path() { | |
return My_Wrapping::$main_template; | |
} |
<?php | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
.gist { | |
color: #e4322e; | |
} | |
.gistdiv { | |
padding: 0; | |
margin: 0; | |
} | |
.gist .gist-file { |
<?php | |
// No, Thanks. Direct file access forbidden. | |
! defined( 'ABSPATH' ) AND exit; | |
// INIT | |
add_action( 'after_setup_theme', array( 'unavailable_post_status', 'init' ) ); | |
class unavailable_post_status extends wp_custom_post_status | |
{ | |
/** |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn
.
Author: Kaspars Dambis
kaspars.net / @konstruktors
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: Plugin Class Demo | |
* Description: How I am using the base class in plugins. | |
* Plugin URI: | |
* Version: 2012.09.29 | |
* Author: Fuxia Scholz | |
* License: GPL | |
* Text Domain: plugin_unique_name | |
* Domain Path: /languages |
Questions asked on the site require some preparation, such as showing that you've done your homework.
Sorry, but this is not an answer.
Please read the [faq].
Please read about XXX in the [faq#XXX].
<?php | |
if ( ! class_exists( 'Autoload_WP' ) ) { | |
/** | |
* Generic autoloader for classes named in WordPress coding style. | |
*/ | |
class Autoload_WP { | |
public $dir = __DIR__; |