- Updated 31 August 2016
- Create new site using "Add Site" button
<?php | |
function example_ajax_enqueue() { | |
// Enqueue javascript on the frontend. | |
wp_enqueue_script( | |
'example-ajax-script', | |
get_template_directory_uri() . '/js/simple-ajax-example.js', | |
array('jquery') | |
); | |
// The wp_localize_script allows us to output the ajax_url path for our script to use. |
#!/bin/sh | |
sudo du -hd 1 | sort -h |
<?php | |
// Register a new route | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'portal/v1', '/messages/favourite/toggle', array( | |
'methods' => 'POST', | |
'callback' => 'change_favorite_status_of_a_message', | |
) ); | |
} ); |
sudo rsync -avz -e "ssh -p 1234" ssh-user@domain:path-to-uploads/* . |
<?php | |
add_filter('acf/load_field/name=name', 'az_acf_meta_box_display'); | |
add_filter('acf/load_field/name=age', 'az_acf_meta_box_display'); | |
add_filter('acf/load_field/name=favorite_colour', 'az_acf_meta_box_display'); | |
/** | |
* Control the display of ACF groups programmatically in WordPress | |
* | |
* @param array $field |
<?php | |
// Open file pointer to standard output | |
$fp = fopen( 'php://output', 'w' ); | |
// Write BOM character sequence to fix UTF-8 in Excel | |
fputs( $fp, $bom = chr(0xEF) . chr(0xBB) . chr(0xBF) ); | |
// Write the rest of CSV to the file | |
if ( $fp ) { |
<?php | |
// Create the query var so that WP catches your custom /staff/username url | |
add_filter( 'query_vars', 'bb_rewrite_add_var' ); | |
function bb_rewrite_add_var( $vars ) | |
{ | |
$vars[] = 'staff'; | |
return $vars; | |
} |