Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: icon_dir

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
497
498           // We have an image without a thumbnail
499
500           $src = $post->guid;
501           $src_file = & $file;
502           $class = 'attachmentimage';
503      } elseif (! empty($mime) ) {
504
505           // No thumb, no image. We'll look for a mime-related icon instead.
506           $icon_dir = apply_filters('icon_dir', get_template_directory().'/images');
507           $icon_dir_uri = apply_filters('icon_dir_uri', get_template_directory_uri().'/images');
508
509           $types = array(substr($mime, 0, strpos($mime, '/')), substr($mime, strpos($mime, '/') + 1), str_replace('/', '_', $mime));
510           $exts = array('jpg', 'gif', 'png');
511           foreach ($types as $type) {
512                foreach ($exts as $ext) {
513                     $src_file = "$icon_dir/$type.$ext";
514                     if ( file_exists($src_file) ) {
515                          $src = "$icon_dir_uri/$type.$ext";