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 tattoo_submit() { | |
if (isset($_POST["addtattoo"])) { | |
$title = "Tattoo : ". $_POST["tatooInput"]; | |
$my_post = array( | |
'post_title' => $title, | |
'post_status' => 'publish', | |
'post_author' => 1, |
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_cdn_upload_url() { | |
return 'http://static.mahtabhussain.com/content/uploads'; | |
} | |
add_filter( 'pre_option_upload_url_path', 'my_cdn_upload_url' ); |
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
define('WP_DEBUG', true); | |
define('WP_DEBUG_LOG', true); | |
define('WP_DEBUG_DISPLAY', false); | |
@ini_set('display_errors',0); | |
ini_set('log_errors',TRUE); | |
ini_set('error_reporting', E_ALL); | |
ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); |
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 add_geo_exif($meta,$file,$sourceImageType) { | |
$exif = @exif_read_data( $file ); | |
if (!empty($exif['GPSLatitude'])) | |
$meta['latitude'] = $exif['GPSLatitude'] ; | |
if (!empty($exif['GPSLatitudeRef'])) | |
$meta['latitude_ref'] = trim( $exif['GPSLatitudeRef'] ); | |
if (!empty($exif['GPSLongitude'])) | |
$meta['longitude'] = $exif['GPSLongitude'] ; | |
if (!empty($exif['GPSLongitudeRef'])) | |
$meta['longitude_ref'] = trim( $exif['GPSLongitudeRef'] ); |
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 safeID( $string, $separator = '_' ) | |
{ | |
$accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i'; | |
$special_cases = array( '&' => 'and'); | |
$string = mb_strtolower( trim( $string ), 'UTF-8' ); | |
$string = str_replace( array_keys($special_cases), array_values( $special_cases), $string ); | |
$string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) ); | |
$string = preg_replace("/[^a-z0-9]/u", "$separator", $string); | |
$string = preg_replace("/[$separator]+/u", "$separator", $string); |
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 toID($string) { | |
//Lower case everything | |
$string = strtolower($string); | |
//Make alphanumeric (removes all other characters) | |
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string); | |
//Clean up multiple dashes or whitespaces | |
$string = preg_replace("/[\s-]+/", " ", $string); | |
//Convert whitespaces and underscore to dash | |
$string = preg_replace("/[\s_]/", "-", $string); | |
return $string; |
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 | |
// Geo Redirect using Cloudflare | |
$activepage = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; | |
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; | |
$page_from = "www.domain.tld/"; | |
$page_to = "www.newdomain.tld/"; | |
?> | |
<!-- Country Code : <?php echo $country_code; ?> --> | |
<!-- Active URL : <?php echo $activepage; ?> --> |
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
add_filter('gettext', 'rename_admin_menu_items'); | |
add_filter('ngettext', 'rename_admin_menu_items'); | |
/** | |
* Replaces wp-admin menu item names | |
* | |
* @author Daan Kortenbach | |
* | |
* @param array $menu The menu array. | |
* | |
* @return $menu Menu array with replaced items. |
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 | |
$attachment_id = get_field('field_name'); | |
$image_thumbnail = wp_get_attachment_image_src( $attachment_id, "thumbnail" ); | |
$image_medium = wp_get_attachment_image_src( $attachment_id, "medium" ); | |
$image_large = wp_get_attachment_image_src( $attachment_id, "large" ); | |
// url = $image[0]; | |
// width = $image[1]; | |
// height = $image[2]; | |
?> | |
<img data-interchange="[<?php echo $image_thumbnail[0]; ?>, (default)], [<?php echo $image_medium[0]; ?>, (large)]"/> |