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
<select name="dob-day" class="datefield day"> | |
<option value="">Day</option> | |
<option value="1">1</option> | |
<option value="2">2</option> | |
<option value="3">3</option> | |
<option value="4">4</option> | |
<option value="5">5</option> | |
<option value="6">6</option> | |
<option value="7">7</option> | |
<option value="8">8</option> |
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
/*********************************************** | |
* JS Google Track and New Window | |
* by Kythin | |
* www.kythin.com | |
* Useage: Simply add an "action" to a link to track it in google analytics. | |
* E.g. <a href='http://www.kythin.com/' action='clicked-kythin'>link</a> | |
* | |
* Requires JQuery | |
***********************************************/ |
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 getCurrentCatID(){ | |
//Probably only works inside the_loop(); | |
global $wp_query; | |
if(is_category() || is_single()){ | |
$cat_ID = get_query_var('cat'); | |
} | |
return $cat_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
<?php | |
/* Chris' magical logo display code. | |
* This will display all images in the uploads/logos directory, and use their filenames for the alt's and titles. | |
* Also allows file ordering by using numbers at the start of the filename, optionally followed by an underscore. | |
* Hyphens will be converted to spaces in the alt and title. Make sure to use the right case in the filename as you want | |
* in the alt & title. | |
* e.g. 0_Company.php => Company | |
* 05_Company-Name => Company Name | |
* 05_logo-Company-Name => Company Name |
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 | |
/* | |
* uses tmhOauth from https://github.com/themattharris/tmhOAuth/ | |
* and is mostly based on the oauth flow example from that library (thanks matt!) | |
* | |
* also need your own twitter api key / secret, and make sure it's got write access | |
* if you want to publish posts (extra step when making your api key on twitter) | |
* | |
* | |
*/ |
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 | |
/* | |
* Wordpress postmeta find&replace code | |
* | |
* This file should be run on your source database to echo out update statements to run on your migrated database. | |
* It is to address the issue of when doing a find/replace on an sql file during a wordpress migration, that breaks | |
* any content changed within wordpress serialized meta values, particularly if you have custom post types etc. | |
* | |
* Do your normal find/replace over the exported sql, import it into your new database, then run this code and copy the resulting | |
* update SQL into your new database to fix it. |
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 | |
/* | |
* Handy redirect function. | |
* Takes one URL parameter that can be relative or absolute. | |
* Optionally also takes timeout in seconds. | |
* Returns null. | |
* If headers have been sent, and no timeout of 0 specified, will do a PHP redirect. | |
* Otherwise, it will do a javascript redirect. | |
*/ |
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 slugify($text) { | |
// replace non letter or digits by - | |
$text = preg_replace('~[^\\pL\d]+~u', '-', $text); | |
// trim | |
$text = trim($text, '-'); | |
// transliterate | |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); |
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 flip($arr) { | |
$out = array(); | |
foreach ($arr as $key => $subarr) | |
{ | |
foreach ($subarr as $subkey => $subvalue) | |
{ | |
$out[$subkey][$key] = $subvalue; | |
} | |
} |
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 forceSSL() { | |
if($_SERVER["HTTPS"] != "on") { | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); | |
exit(); | |
} | |
} |
OlderNewer