barryp
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [Multiple Post Thumbnails] Conditional Default ImageSweet!! Glad it works for ya.
Forum: Plugins
In reply to: [Multiple Post Thumbnails] Conditional Default ImageSorry for the delay. After looking through the plugin code, there is a has_post_thumbnail option. I came up with this that I’m sure could be written better, I’m still learning.
// Check for Plugin if (class_exists('MultiPostThumbnails')) { // Set Thumbnail $thumb = MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'preview-image'); $has_thumb = MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'preview-image', strval(get_the_ID())); // Thumbnail exist? Else show Not Found if ($has_thumb) : echo $thumb; else : echo '<img src="'. get_bloginfo('template_directory') . '/img/default_thumb.jpg" />'; endif; // Plugin not found. } else { echo "MultiPostThumbnails Not Found."; }Forum: Plugins
In reply to: [Multiple Post Thumbnails] Conditional Default ImageJust noticed this. Give me a few.
Forum: Plugins
In reply to: [Multiple Post Thumbnails] Conditional Default ImageLet me know if this doesn’t work for you.
// Check for Plugin if (class_exists('MultiPostThumbnails')) { // Set Thumbnail $thumb = MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'preview-image'); // Thumbnail exist? Else show Not Found if ($thumb) : echo $thumb; else : echo '<img src="url/to/default/image.jpg">'; endif; // Plugin not found. } else { echo "MultiPostThumbnails Not Found."; }
Viewing 4 replies - 1 through 4 (of 4 total)