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
## Example DOMAIN.TLD serves MAIN folder | |
## SUB folder served from SUB.DOMAIN.TLD | |
## --- public_html/ .htaccess --- ## | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^(www.)?DOMAIN.TLD/$ | |
RewriteRule ^$ /MAIN/ [L] | |
# Remove WWW (optional) |
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
# 1. Use htapasswd to set new pass for admin | |
sudo htpasswd /etc/apache2/.htpasswd admin | |
# 2. Update /etc/apache2/apache2.conf with folders to be protected | |
<DirectoryMatch ^.*/protected-folder/> | |
AuthType Basic | |
AuthName "Restricted Area" | |
AuthUserFile /etc/apache2/.htpasswd | |
Require valid-user | |
</DirectoryMatch> |
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
function nested_custom_background_cb() { | |
ob_start(); | |
_custom_background_cb(); | |
$bg_style_tag = ob_get_contents(); | |
ob_end_clean(); | |
$bg_style_tag = str_replace( 'body.custom-background', 'body.custom-background #canvas', $bg_style_tag ); | |
echo $bg_style_tag; | |
} | |
add_theme_support( 'custom-background', array( 'wp-head-callback' => 'nested_custom_background_cb' ) ); |
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 | |
// Reregister Open-sans as Roboto. | |
function replace_open_sans() { | |
// Replace the URL with your local or remote css | |
$roboto_open_sans_url = get_template_directory_uri().'/assets/fonts/roboto-hack.css'; | |
wp_deregister_style( 'open-sans' ); | |
wp_register_style( 'open-sans', $roboto_open_sans_url ); | |
} | |
add_action( 'admin_enqueue_scripts', 'replace_open_sans' ); |
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
add_action('save_post', 'wpds_check_thumbnail'); | |
add_action('admin_notices', 'wpds_thumbnail_error'); | |
function wpds_check_thumbnail($post_id) { | |
// change to any custom post type | |
if(get_post_type($post_id) != 'post') | |
return; | |
if ( !has_post_thumbnail( $post_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
<div id="wrapper"> | |
<header class="group"> | |
<h1>Email auto-suggest</h1> | |
<p id="author" class="group">By Stuart Tayler</p> | |
<a href="https://twitter.com/share" class="twitter-share-button" data-via="stuarttayler1" data-count="none">Tweet</a> | |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> | |
</header> | |
<p>Email address</p> | |
<div id="placement"> |
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
# Adds a user and gives admin permissions to Wordpress database | |
# Change db_wordpress to DB name | |
# Change wp_ to your table prefix | |
# Change username, pass, nicename, email, url, displayname and pass to your new user info | |
# Change date to whenever you want the registered date to be | |
INSERT INTO `db_wordpress`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES (NULL, 'username', MD5('pass'), 'nicename', 'email', 'url', '2010-10-08 00:00:00', '', '0', 'displayname'); | |
# Find the userid that was just created (int) |
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
# First connect to host via SSH - cd to public_html or httpdocs | |
# Download latest WP to host (zip or tar.gz) | |
wget http://wordpress.org/latest.tar.gz | |
# Extract it | |
tar xzvf latest.tar.gz | |
# Move it out of 'wordpress' directory | |
mv wordpress/* ~/public_html |
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
UPDATE wp_options SET option_value = REPLACE (option_value, 'http://oldurl','http://newurl'); | |
UPDATE wp_posts SET guid = REPLACE (guid,'http://orldurl','http://newurl'); | |
# Change "wp_" to your database's table prefix | |
# Change oldurl, newurl (oldurl is the one in the database already) |
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
# migrate from host to dest server - requires pass | |
rsync -zav --delete --progress public_html/ user@host:public_html/ |
OlderNewer