Posted on 1 Comment

WPYUI Theme “Header” Hack: Utilizing Post Thumbnails

WordPrss Theme Default Thumbnail

I am glad I learned by doing, that I can put current Post Thumbnails as the “header-image”, utilizing hybrid theme code

<?php if ( current_theme_supports( 'get-the-image' ) ) get_the_image( array( 'custom_key' => array( 'Header Image' ), 'size' => 'header-image', 'image_scan' => true, 'default_image' => get_stylesheet_directory_uri() . '/images/default_thumb.gif' ) ); ?>

Let us see how it appears on my localhost blog. This is the image at home or front page. When it comes to front-page, then it will display the latest post thumbnails. I have posted the Condolences Message for the Late John Talu Tekwie from Lido Village, Vanimo Town, Sandaun Province, Papua New Guinea as the latest news. That is why the image from this latest news is the default header image.

WPYUI WordPress Theme Header Image from Post Thumbnail
WPYUI WordPress Theme Header Image from Post Thumbnail

When I click on “other than home page or front page”, for example the following image is the “default_thumb.gif” in header image size when I clicked the Category Page or other articles and pages image on the post will display this “default_thumb.gif”.

Default Thumb in Category Page
Default Thumb in Category Page

This means, you need I have created and uploaded my “default_thumb.gif” into my theme images folder “wp-content/themes/wpyui/images/”.

WordPrss Theme Default Thumbnail
WordPrss Theme Default Thumbnail

It means, if current theme supports get_the_image extension of the Theme Hybrid by Justin Tadlock, then I order the theme to call the Post Thumbnail or the First Post Thumbnail to appear as header image.

If there is no “thumbnail” or image, then there will be “default_thumb.gif”.

This “default_thumb” approach has been my favourite way of displaying images as I like thumbnails for my entries.