OK, here's something I'm trying to figure out..... Is there a way to specify a default thumbnail in my functions.php file?
Currently I have this (in functions.php):
// THIS IS THUMBNAIL SUPPORT
if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails
add_image_size( 'single-post-thumbnail', 300, 999 ); // Permalink thumbnail size
add_image_size( 'title-image', 50, 27 ); // Title mini photo
}
// THIS LINKS THE THUMBNAIL TO THE POST PERMALINK
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
return $html;
}
to define my thumbnail, and to link it to the permalink
now I use the thumbnail and it's various iterations throughout my theme. So atm, I use this to swap in a default image in one of the locations (index.php):
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('title-image', array('class' => 'titleImage', 'alt' => 'Title Icon'));
} else {
echo "<img src='" . get_bloginfo('template_directory') .
"/images/defaultIcons/voodooTitleDefault.png' alt='Default Title Icon' title='Default Title Icon' class='titleImage' />"; }
?>
which works fine enough. But I have to include that buncha code in each of 4 or 5 locations to get a default image. Plus I use the thumbnail on my main (non-WP) page...it's getting to be a pain to use all that. Plus the if/else I have above doesn't include the permalink link.
So.....is there a way for me to specify the default thumbnail one time in functions.php, so all of my thumbnail uses throughout my theme and beyond will have the default available if I don't specifiy one?
Thanks much in advance!