This file contains 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
/* Prevent YouTube Related Content on oEmbed-ed videos */ | |
add_filter( 'oembed_result', 'prevent_featured_youtube_videos' ); | |
function prevent_featured_youtube_videos( $embed ) { | |
return str_replace( '?feature=oembed', '?feature=oembed&rel=0', $embed ); | |
} |
This file contains 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
... | |
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$ | |
slack[name=%(__name__)s] | |
action = %(action_with_slack_notification)s | |
... |
This file contains 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 | |
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 ); |
This file contains 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 | |
function copy_post_to_blog($post_id, $target_blog_id) { | |
$post = get_post($post_id, ARRAY_A); // get the original post | |
$meta = get_post_meta($post_id); | |
$post['ID'] = ''; // empty id field, to tell wordpress that this will be a new post | |
switch_to_blog($target_blog_id); // switch to target blog | |
$inserted_post_id = wp_insert_post($post); // insert the post | |
foreach($meta as $key=>$value) { | |
update_post_meta($inserted_post_id,$key,$value[0]); | |
} |
This file contains 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
DELETE FROM wp_usermeta | |
WHERE NOT EXISTS ( | |
SELECT * FROM wp_users | |
WHERE wp_usermeta.user_id = wp_users.ID | |
) |
This file contains 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 | |
/** | |
* Modification of `paginate_links()` Wordpress built-in function. | |
* Returns an array of objects describing links instead of generating HTML for links. | |
* @param array $args Same as `paginate_links()` arguments array. Exceptions: `classes` mapping for CSS classes; `type` is ignored | |
* @return array Returns an array of objects representing links that can be used to generate HTML | |
*/ | |
function paginate_links_array($args = '') { | |
$defaults = array( |
This file contains 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
Vagrant::Config.run do |config| | |
config.vm.box = "lucid32" | |
config.vm.box_url = "http://files.vagrantup.com/lucid32.box" | |
config.vm.provision :chef_solo do |chef| | |
chef.cookbooks_path = "cookbooks" | |
# pass json_attribs to chef | |
chef.json = { |
This file contains 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 | |
$countries = array | |
( | |
'AF' => 'Afghanistan', | |
'AX' => 'Aland Islands', | |
'AL' => 'Albania', | |
'DZ' => 'Algeria', | |
'AS' => 'American Samoa', | |
'AD' => 'Andorra', |