codeSnippets(All);

Load FontAwesome by link and in WP

function load_fontawesome(){
  wp_enqueue_style('fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
}
add_action('wp_enqueue_scripts', 'load_fontawesome');

Showing 4 lines of 11 total lines in this snippet.

Access folder as root

sudo -i
cd /path/folder
exit

Showing 3 lines of 4 total lines in this snippet.

Include Google Web Fonts

<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">

Showing 1 lines of 9 total lines in this snippet.

Return short text snippet function

function textSnippet($string,$length=200){
  return preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
}

Showing 3 lines of 3 total lines in this snippet.

SQL queries to move WordPress

UPDATE wp_options SET option_value = replace(option_value, 'http://www.sitename.com', 'https://www.sitename.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.sitename.com','https://www.sitename.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.sitename.com', 'https://www.sitename.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.sitename.com','https://www.sitename.com');

Showing 4 lines of 5 total lines in this snippet.

Simple JSON array

{"array":[{
"date": "01 Dec 2016",
"title": "Title 1",
"description": "Lorem amet ipsum dolor sit."
},{
"date": "02 Dec 2016",
"title": "Title 2",
"description": "Lorem ipsum amet dolor sit."
},{
"date": "03 Dec 2016",
"title": "Title 3",
"description": "Lorem ipsum sit dolor amet."
},{
"date": "04 Dec 2016",
"title": "Title 4",
"description": "Lorem ipsum dolor amet sit."
},{
"date": "05 Dec 2016",
"title": "Title 5",
"description": "Lorem dolor ipsum sit amet."
}]}

Showing 21 lines of 21 total lines in this snippet.

Single item JSON

{"text":"<p>Here's some text in html tags in a json element also using \"quotes\"</p>"}

Showing 1 lines of 1 total lines in this snippet.