This file contains hidden or 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
/** | |
* Forces all PDF links to download automatically, if the browser supports it. | |
* Otherwise, open the link in a new browser window or tab. | |
*/ | |
jQuery(document).ready(function($) { | |
$('a[href$=".pdf"]') | |
.attr('download', '') | |
.attr('target', '_blank'); | |
}); |
This file contains hidden or 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 | |
/** | |
* Loads media from a remote site when on a local dev environment. | |
* Eliminates the need to download the uploads directory from the remote site for testing purposes. | |
*/ | |
if ( 'mydomain.dev' === $_SERVER['HTTP_HOST'] ): | |
add_filter( 'upload_dir', function ( $uploads ) { | |
$uploads['baseurl'] = 'http://mydomain.com/wp-content/uploads'; |
This file contains hidden or 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 | |
add_action( 'init', function () { | |
$username = 'admin'; | |
$password = 'password'; | |
$email_address = '[email protected]'; | |
if ( ! username_exists( $username ) ) { | |
$user_id = wp_create_user( $username, $password, $email_address ); |
This file contains hidden or 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 | |
/** | |
* Class Custom_Page_Templates | |
*/ | |
class Custom_Page_Templates { | |
/** | |
* Storage for all custom template paths | |
* |
This file contains hidden or 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
echo "<?php" > salt.php | |
wget https://api.wordpress.org/secret-key/1.1/salt/ -O - >> salt.php |
This file contains hidden or 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 | |
/** | |
* Class Attachment_Query | |
*/ | |
class Attachment_Query extends WP_Query { | |
function __construct( $query = '' ) { | |
$defaults = array( | |
'post_type' => 'attachment', |
This file contains hidden or 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 | |
/** | |
* WP-CLI script for moving a multi-site instance from one domain to another | |
* | |
* Example command usage: wp eval-file multisite-migrate.php old-domain.com new-domain.com | |
* Note: Currently, this script doesn't update all domain references, such as in post content. | |
* At this time, it is primarily used when creating a local copy of a multi-site instance in | |
* order to ensure everything will load on a local dev domain. | |
*/ |