Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

Featured image showing in header - possible?


  #1  
Old Oct 2, 2012, 04:37 PM
furiousfrog
 
23 posts · May 2009
Hi there,

Love the theme - have managed to insert a logo instead of the title, but am trying to show the featured image in the header.

This is what I've added to the header.php sub-template:

<?php
if(has_post_thumbnail()){
echo '<div class="other-image-header">';
the_post_thumbnail('full');
echo '</div>';
}
else{
echo '<div class="default-image-header"></div>';
}
?>

and put this in various.css:

.default-image-header {
display: block;
width: 404px;
height: 202px;
background: url("%tpldir%/images/home.png");
}

.other-image-header {
width: 404px;
height: 202px;
}



Yet, for some reason I just can't get "the_post_thumbnail" to display, despite trying various iterations. Would love some advice on where I'm going wrong, or even a pointer in the right direction?
  #2  
Old Oct 2, 2012, 05:27 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you can't access post information untill you are in 'The LOOP' and the featured image is part of a post. You can do it, it just you will have to code a wp-query. It might be much easier to find a plugin that would do it for you.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Oct 3, 2012, 02:13 AM
furiousfrog
 
23 posts · May 2009
Hi Juggledad,

I did wonder if that was the case - saw something similar in the codex, but there seemed to be lots of tutorials on the net suggesting that you could just place the query in the header!

Thanks for the reply, much appreciated. I'm trying to improve my abysmal php knowledge but I do think a plugin would be better in the first instance - I can always pick that apart!

Cheers,

ff

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
The Featured Image NOT showing up in from the page anymore? Luis Lecca Post-Kicker, -Byline & -Footer 4 Feb 2, 2012 12:14 PM
Featured image won't resize Pierre Excerpts, Read more, Pagination 5 Jan 31, 2011 10:13 AM
[SOLVED] Header Image not showing socalfusions Header configuration & styling 1 Jul 25, 2010 01:40 AM
Can i have more than one image showing in my header at one time kimkitch Header configuration & styling 4 May 31, 2010 11:56 AM
[SOLVED] Header image not showing ellie Header configuration & styling 6 Oct 29, 2009 12:05 PM


All times are GMT -6. The time now is 12:12 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.