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 | |
| class Google_Weather | |
| { | |
| public $condition; | |
| public $temperature; | |
| public $humidity; | |
| public $icon; | |
| public $wind_direction; | |
| public $wind_speed; |
| <?php | |
| /* | |
| Plugin Name: R Debug | |
| Description: Set of dump helpers for debug. | |
| Author: Andrey "Rarst" Savchenko | |
| Author URI: https://www.rarst.net/ | |
| License: MIT | |
| */ |
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
| <?php | |
| add_action('admin_init', 'add_meta_boxes', 1); | |
| function add_meta_boxes() { | |
| add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high'); | |
| } | |
| function repeatable_meta_box_display() { | |
| global $post; |
| <?php | |
| class User | |
| { | |
| public $admin; | |
| public $roles = array(); | |
| function roles() | |
| { | |
| if (isset($this)) |
| /** | |
| * Get the offset of the given timezone (in seconds) | |
| */ | |
| function getTimeZoneOffset($timezone='') { | |
| $tz_tmp = new DateTimeZone($timezone); | |
| $dt_tmp = new DateTime('now', $tz_tmp); | |
| $offset = $dt_tmp->getOffset(); | |
| return $offset; | |
| } |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| <?php | |
| $theme_data; | |
| if (function_exists('wp_get_theme')){ | |
| $theme_data = wp_get_theme('theme-name'); | |
| $theme_uri = $theme_data->ThemeURI; | |
| $author_uri = $theme_data->Author_URI; | |
| } else { | |
| $theme_data = (object) get_theme_data(get_template_directory() . '/style.css'); | |
| $theme_uri = $theme_data->URI; | |
| $author_uri = $theme_data->AuthorURI; |
| <?php | |
| /** | |
| * Simple WordPress Twitter feed | |
| * | |
| * | |
| * @param string $user user of twitter feed to retrieve. | |
| * @param string $count number of tweets to retrive. | |
| * | |
| * Inspiration for code: | |
| * Chip Bennet's oenology theme https://github.com/chipbennett/oenology |