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 | |
/** | |
* Display a custom taxonomy dropdown in admin | |
* @author Mike Hemberger | |
* @link http://thestizmedia.com/custom-post-type-filter-admin-custom-taxonomy/ | |
*/ | |
add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy'); | |
function tsm_filter_post_type_by_taxonomy() { | |
global $typenow; | |
$post_type = 'team'; // change to your post type |
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
/** | |
* Borrowed from https://github.com/addyosmani/jquery-ui-bootstrap | |
* Styles the datepicker popup for gravityforms used with bootstrap | |
*/ | |
/* | |
* jQuery UI Datepicker | |
* | |
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license |
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 | |
function slugify($text){ | |
$text = preg_replace('~[^\\pL\d]+~u', '-', $text); // replace non letter or digits by - | |
$text = trim($text, '-'); // trim | |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); // transliterate | |
$text = strtolower($text); // lowercase | |
$text = preg_replace('~[^-\w]+~', '', $text); // remove unwanted characters | |
if (empty($text)){ | |
return 'n-a'; | |
} |
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 | |
if (!function_exists('get_post_id_by_meta_key_and_value')) { | |
/** | |
* Get post id from meta key and value | |
* @param string $key | |
* @param mixed $value | |
* @return int|bool | |
* @author David Mårtensson <david.martensson@gmail.com> | |
*/ | |
function get_post_id_by_meta_key_and_value($key, $value) { |
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
/*** | |
* Formats a phone number to be used in a callto: link | |
* Input: Phone number string with special characters | |
* Output: Phone number without special characters | |
***/ | |
function mh_format_phone_number($phone){ | |
return preg_replace('~[\W\s]~', "", $phone); | |
} |
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
/*** | |
* Converts a hex color value to it an rgb value array | |
* Input: Hex value string | |
* Output: Array of RGB Values | |
***/ | |
function mh_hex2rgb($hex) { | |
$hex = str_replace("#", "", $hex); | |
if(strlen($hex) == 3) { |
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
/*** | |
* Formats an array of RGB values to a HEX colour value | |
* Input: Array of RGB Values | |
* Output: Hex value string | |
***/ | |
function mh_rgb2hex($rgb) { | |
$hex = "#"; | |
$hex .= str_pad(dechex($rgb[0]), 2, "0", STR_PAD_LEFT); | |
$hex .= str_pad(dechex($rgb[1]), 2, "0", STR_PAD_LEFT); |