Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.
function foo ({
bar = 'no',
baz = 'works!'
} = {}) {
vagrant ssh | |
cd /srv/www/ | |
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs | |
wp core download | |
wp core config --dbname=site-name --dbuser=root --dbpass=root | |
wp db create | |
wp core install --url=site-name.dev --title=Site --admin_user=admin --admin_pass=password [email protected] |
<?php | |
/* | |
* Add "Formats" dropdown to TinyMCE Editor | |
*/ | |
function matt2015_mce_formats($buttons) { | |
array_unshift($buttons, 'styleselect'); | |
return $buttons; | |
} | |
add_filter('mce_buttons_2', 'matt2015_mce_formats'); |
<?php | |
/** | |
* An example function used to demonstrate how to use the `user_can_save` function | |
* that provides boilerplate security checks when saving custom post meta data. | |
* | |
* The ultimate goal is provide a simple helper function to be used in themes and | |
* plugins without the need to use a set of complex conditionals and constants. | |
* | |
* Instead, the aim is to have a simplified function that's easy to read and that uses | |
* WordPress APIs. |
<?php | |
/* | |
How To Locally Mirror Remote Images With WordPress | |
Source: http://forrst.com/posts/Locally_Mirror_Remote_Images_With_WordPress-XSE | |
*/ | |
// URL of the image you want to mirror. Girl in pink underwear for instance. | |
$image = 'http://i.imgur.com/Hq4QA.jpg'; |
Copyright (c) 2011 ZURB, http://www.zurb.com/ |