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
UPDATE table_name SET COLUMN = REPLACE(COLUMN, 'old_text', 'new_text'); |
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
//If you only want to show directories, replace "-type f" with "-type d". | |
find . -type f -exec du -sk {} \; | sort -nr |
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
/** | |
* Getting taxonomy from DB without having links | |
* @param $post_id | |
* @return string "tag1,tag3,tag4" | |
*/ | |
function go_get_terms($id){ | |
global $wpdb; | |
$q = 'SELECT * from wp_terms t LEFT JOIN wp_term_relationships r on r.term_taxonomy_id = t.term_id WHERE object_id = '.$id; | |
$rows = $wpdb->get_results($wpdb->prepare($q)); | |
$out = ""; |
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
function my_admin_help($text, $screen) { | |
// Check we're only on my Settings page | |
if (strcmp($screen, MY_PAGEHOOK) == 0 ) { | |
$text = 'Here is some very useful information to help you use this plugin...'; | |
return $text; | |
} | |
// Let the default WP Dashboard help stuff through on other Admin pages | |
return $text; | |
} |
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
$states = array(''=>"STATE",'AL'=>"Alabama",'AK'=>"Alaska",'AZ'=>"Arizona",'AR'=>"Arkansas", 'CA'=>"California", 'CO'=>"Colorado", 'CT'=>"Connecticut", 'DE'=>"Delaware", 'DC'=>"District Of Columbia", 'FL'=>"Florida", 'GA'=>"Georgia", 'HI'=>"Hawaii", 'ID'=>"Idaho", 'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas", 'KY'=>"Kentucky", 'LA'=>"Louisiana", 'ME'=>"Maine", 'MD'=>"Maryland", 'MA'=>"Massachusetts", 'MI'=>"Michigan", 'MN'=>"Minnesota", 'MS'=>"Mississippi", 'MO'=>"Missouri", 'MT'=>"Montana", 'NE'=>"Nebraska", 'NV'=>"Nevada", 'NH'=>"New Hampshire", 'NJ'=>"New Jersey", 'NM'=>"New Mexico", 'NY'=>"New York", 'NC'=>"North Carolina", 'ND'=>"North Dakota", 'OH'=>"Ohio", 'OK'=>"Oklahoma", 'OR'=>"Oregon", 'PA'=>"Pennsylvania", 'RI'=>"Rhode Island",'SC'=>"South Carolina",'SD'=>"South Dakota",'TN'=>"Tennessee",'TX'=>"Texas",'UT'=>"Utah",'VT'=>"Vermont",'VA'=>"Virginia",'WA'=>"Washington",'WV'=>"West Virginia",'WI'=>"Wisconsin",'WY'=>"Wyoming"); | |
$states = array('AL'=>"Alabama", | |
'AK'=>" |
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 | |
//set images directory | |
$directory = 'wp-content/themes/mizzou/images/banners/'; | |
try { | |
// create slideshow div to be manipulated by the above jquery function | |
echo "<div id=\"slideshow\">"; | |
//iterate through the directory, get images, set the path and echo them in img tags. | |
foreach ( new DirectoryIterator($directory) as $item ) { | |
if ($item->isFile()) { | |
$path = $directory . "/" . $item; |
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
/** | |
* Desc: Get image source from feature image | |
* @param $id | |
* @param $icon = 'thumbnail, medium, large or full' | |
* @return $image source | |
*/ | |
function get_me_the_thumbnail_src($id , $size = 'full'){ | |
$tmp = wp_get_attachment_image_src ( get_post_thumbnail_id ( $id ), $icon ) ; | |
$str = $tmp[0]; | |
return $str; |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} domain.com | |
RewriteRule (.*)$ http://newdomain.com/$1 [L] | |
RewriteRule ^index\.php$ - [L] | |
RewriteRule ^css/(.*) /wp-content/themes/roots/css/$1 [QSA,L] | |
RewriteRule ^js/(.*) /wp-content/themes/roots/js/$1 [QSA,L] | |
RewriteRule ^img/(.*) /wp-content/themes/roots/img/$1 [QSA,L] |
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
/** | |
* Function: sanitize | |
* Returns a sanitized string | |
* | |
* Parameters: | |
* $string - The string to sanitize. | |
* $force_lowercase - Force the string to lowercase? | |
* $anal - If set to *true*, will remove all non-alphanumeric characters. | |
*/ | |
function sanitize($string, $force_lowercase = true, $anal = false) { |
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
if (is_admin()) : | |
function my_remove_meta_boxes() { | |
if(!current_user_can('administrator')) { | |
remove_meta_box('linktargetdiv', 'link', 'normal'); | |
remove_meta_box('linkxfndiv', 'link', 'normal'); | |
remove_meta_box('linkadvanceddiv', 'link', 'normal'); | |
remove_meta_box('postexcerpt', 'post', 'normal'); | |
remove_meta_box('trackbacksdiv', 'post', 'normal'); | |
remove_meta_box('commentstatusdiv', 'post', 'normal'); | |
remove_meta_box('postcustom', 'post', 'normal'); |