Created
January 21, 2010 21:22
-
-
Save zachseifts/283213 to your computer and use it in GitHub Desktop.
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 | |
/** Function fixing a title | |
* | |
* On the homepage for Wall to Wall Photos (and I guess other pages) the | |
* rotating image's title is fucked up and it's really annoying me. Here's | |
* a function that should fix it. | |
* | |
* That way if a title is `IMG_S4_500` it would be transformed into | |
* 'No Title'. When a title is `file_name` it will be transformed into | |
* `File Name`. | |
* | |
* Where this is placed is unknown to me at the moment, only because I don't | |
* have my public key in in my authorized_hosts for this machine. I think It | |
* should be put somewhere around template.php and override the hook that | |
* controls object titles, hook_title or something. | |
* | |
* @param string $title | |
* @return string | |
**/ | |
function fix_title($title) { | |
if (strlen(strstr($title, 'IMG')) > 0) { | |
// First of fix the 'IMG' titles. | |
return 'No Title'; | |
} elseif (count(explode(' ', $title)) == 1) and (strlen(strstr($title, '_')) > 0) { | |
// Now fix the 'file_name' ones. | |
$title = explode('_', $title); | |
return ucwords(implode(' ', $title)); | |
}; | |
return $title; | |
// like nothing happened. | |
}; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment