~
(?:(smile\.|www\.))? # optionally starts with smile. or www.
ama?zo?n\. # also allow shortened amzn.com URLs
(?:
com # match all Amazon domains
|
ca
|
co\.uk
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
// Paste this at the end of functions.php | |
// or add as a separate file in mu-plugins including a leading opening < ? php tag in front. | |
// Activate WordPress Maintenance Mode | |
function wp_maintenance_mode() { | |
if ( ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) && !( is_admin() || stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] ) ) ) { | |
$message = '<!doctype html> | |
<title>Site Maintenance</title> | |
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet"> | |
<style> |
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
The do_meta_boxes filter is run 3 times for every editor page load. Once for each context. | |
So you only need to remove the metabox if you are in an editor you care about. | |
There are 3 parameters sent in the do_meta_boxes filter. So add the action this way: | |
`add_action( 'do_meta_boxes', 'remove_unwanted_metaboxes', 10, 3 );` | |
And then do something like this: | |
``` |
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
// This gets the modified time for the current style sheet. It caches the check for 30 seconds. | |
// That's the longest you'd have to wait for a new style sheet to be forced on all visitors. | |
// This micro-caching helps limit drive access when the site is busy. | |
// You could change it to 5 seconds on a less busy site or any value you like | |
function enqueue_versioned_child_style() { | |
// StyleSheet date is only checked once every 30 seconds | |
if ( false === ( $stylesheetmtime = get_transient( 'stylesheetmtime' ) ) ) { | |
// It wasn't there, so regenerate the data and save the transient | |
$stylesheetmtime = filemtime( get_stylesheet_directory() . '/style.css'); | |
set_transient( 'stylesheetmtime', $stylesheetmtime, 30 ); |
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
class THING_DOER | |
{ | |
/** | |
* Holds the values to be used in the fields callbacks | |
*/ | |
private $option_name; | |
private $page_name; | |
private $options; | |
private $action; |
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 | |
/** | |
* Ensures the passed text, presumably an url, ends with '/amp/' | |
*/ | |
if ( !function_exists( 'trailingampit' ) ) { | |
function trailingampit( $string ) { | |
return untrailingampit( $string ) . 'amp/'; | |
} | |
} |
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 | |
/* | |
Plugin Name: DenyHosts | |
Plugin URI: http://pross.org.uk | |
Description: Block bad login attempts. | |
Version: 1.0 | |
Author: Pross | |
*/ | |
class DenyHosts { |
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 | |
/* | |
* dl-file.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.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 | |
/* | |
* dl-file.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.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 | |
/* | |
* dl-file.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.0+ |