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
<?php | |
// MyShortcode usage [myshortcode greeting="Hello" who="World"] | |
function myshortcode_func( $atts, $content = null ) { | |
// use given attributes or defined defaults | |
extract( shortcode_atts( array( | |
'greeting' => '', | |
'who' => '' | |
), $atts ) ); |
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 get_daterange_regex( $from, $to, $input_format ) { | |
// get the difference in months | |
$date1 = DateTime::createFromFormat( $from, $input_format ); | |
$date2 = DateTime::createFromFormat( $to, $input_format ); | |
$interval = $date1->diff($date2); | |
$months = $interval->m; | |
// get an array of the interveening months | |
$all_months = 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
# migrate from host to dest server - requires pass | |
rsync -zav --delete --progress public_html/ user@host: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
mkdir -p db_export_tmp | |
mysqldump --add-drop-table -efK -u DB_USER -pPASS DB_NAME > tmp/DB_NAME.sql | |
mysql -h host -u DB_USER -pPASS DB_NAME < tmp/DB_NAME.sql | |
rm -rf db_export_tmp |
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
jQuery(document).ready(function($) { | |
function dataTable(data) { | |
var response_table = $('<table class="widefat"></table>'); | |
var header = $('<thead><tr></tr></thead>'); | |
for(var k in data[0]) { | |
header.append('<th>'+k+'</th>'); | |
} | |
response_table.append(header); |
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
# find uploads > not web files > files only > older than 6 months | |
find ~/public_html/wp-content/uploads/gravity_forms/* -not -name "*.html" -not -name "*.php" -type f -mtime +182 | |
# Find > delete | |
find ~/public_html/wp-content/uploads/gravity_forms/* -not -name "*.html" -not -name "*.php" -type f -mtime +182 -exec rm {} \; |
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) |
OlderNewer