Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
nielsenrc / mysql-find-replace-wordpress-db.sql
Created April 28, 2016 16:06
MySQL | MySql Query to Sweep Wordpress Database for String
UPDATE wp_posts SET post_content = REPLACE(post_content,'find','replace');
UPDATE wp_posts SET guid = REPLACE(guid,'find','replace');
@nielsenrc
nielsenrc / wordpress-command-line-cheatsheet.txt
Last active May 3, 2016 21:33
Wordpress | Command Line Cheatsheet
#Create database
create database [database name];
#Grant permissions and create users
grant select, update, insert, create, delete on [database].* to [user];
#Set password for user
set password for [user] = password('');
#Flush Privileges
@nielsenrc
nielsenrc / wordpress-change-text-of-previous-and-next-links.php
Created November 9, 2015 21:43
Wordpress | Change Text of Previous and Next Links
@nielsenrc
nielsenrc / php-calls-ziptastic.php
Created October 29, 2015 14:31
PHP Function for Authenticated Calls to Ziptastic
<?php
function callZiptastic($zipcode, $referrerDomain, $apiKey) {
$url = "https://zip.getziptastic.com/v3/US/" . $zipcode;
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => 1,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
@nielsenrc
nielsenrc / wix-to-wordpress-redirect
Created October 14, 2015 21:05
Wix to Wordpress Redirect
//this goes in functions.php because wix uris are unredirectable in apache htaccess
function themee_hash_redirects() {
?>
<script type="text/javascript">
function themee_hashtag_redirect( hashtag, url) {
var locationHash = document.location.hash;
console.log(locationHash);
console.log(hashtag);
if ( hashtag == locationHash ) {
document.location.href = url;
@nielsenrc
nielsenrc / whm-cpanel-bash-unsuspend-user.sh
Created October 1, 2015 19:33
WHM | cPanel | Unsuspend User from Command Line
/scripts/unsuspendacct <user>
@nielsenrc
nielsenrc / md5.php
Created September 30, 2015 20:17
Wordpress | Create New Password to Add to DB
<?php echo md5('password');?>
@nielsenrc
nielsenrc / shopify-use-shopify-api-to-bulk-import-301-redirects.php
Last active July 13, 2017 00:30
Shopify | PHP | Use Shopify API to Bulk Import 301 Redirects
<?php
// In Shopify go to Apps -> Private Apps to get API Key
// List of Redirects under Online Store -> Navigation -> Redirects
$api_key = "";
$password = "";
$store_subdomain = ""; //
$shopify_url = "https://" . $api_key . ":" . $password . "@" . $store_subdomain . ".myshopify.com/admin/redirects.json";
$array_of_redirects = array (
'[/from-uri]' => '[/to-uri]',
);
@nielsenrc
nielsenrc / advanced-custom-fields-state-drop-down.txt
Created September 24, 2015 22:12
Advanced Custom Fields State Drop Downs
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
CT : Connecticut
DE : Delaware
DC : District Of Columbia
FL : Florida
@nielsenrc
nielsenrc / us-state-dropdown.html
Created September 17, 2015 20:10
HTML | US State Dropdown
<select>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>