Jump to content
Sign in to follow this  
ocdee

Different header on post page only

Recommended Posts

ocdee    0
ocdee

Hi all - Not sure if I'm approaching this correctly so I'm open to suggestions. I'm trying to get a different header image just for the post page of a site I'm working on. (WP 3.1, Platform Pro 1.3.2) Main site is http://patbarone.com/sandbox Post page is here... I hid branding for post pages and now want that banner above the navigation. http://patbarone.com/sandbox/?page_id=14 Was playing with hooks, but apparently, (beyond moving a search bar per the demo) can't quite wrap my head around it yet. Thanks!

Share this post


Link to post
Share on other sites
Kate    3
Kate

Hey Dee, What about using a feature box or banner on the "Blog and Posts" page in "Settings->Template Setup"?

Share this post


Link to post
Share on other sites
Simon    247
Simon

Maybe use an action: `add_action( 'pagelines_before_header', 'add_my_header' );` `function add_my_header() {` `echo 'your image here';` `}`

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

Thanks for the reply Kate :) I have the image on http://patbarone.com/sandbox/?page_id=14 in the 'fullwidth sidebar' widget at this point. Tried putting the image in a banner and have a whole new set of issues. Here's what I did - created a new banner set with that one image and named it "blog header". Within the meta settings of the blog page, I have it set to show 'blog header' yet now I see my product banners as well. Also, now on the products page, I see the 'blog header' even though I have the meta settings on the products page set to only show the 'product' banner set. Seems like it would be much easier to use a hook or something to move the widget before navigation (or move navigation below the widget) - I just don't which function to use and how to get it to do it on just one page. This is what I had tried based off of the hooks tutorial: add_action('pagelines_before_primary-nav', 'blog_header'); function blog_header(){ get_fullwidth_sidebar(); } though am guessing get_fullwidth_sidebar isn't valid?

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

Simon, just saw your reply - thank you! That might just work - seems like it would grab that image for all pages though...

Share this post


Link to post
Share on other sites
Simon    247
Simon
That might just work - seems like it would grab that image for all pages though...
Easy, add a conditional ;) `if ( is_page('slug') ) echo 'xx';` use this in the snippet I gave you before, replacing `slug` with the page slug you want it to appear on.

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

Here's what I have and no luck - could it be because of the slug? I have WP installed in a subdirectory for development, so the blog is located at http://patbarone.com/sandbox/blog

add_action('pagelines_before_primary-nav', 'blog_header');
		function blog_header(){
		if ( is_page('blog') ) echo '<src=http://"patbarone.com/sandbox/SRWL_banner.png" />';
		}

(edited code to take out 'img' before 'src' so it wouldn't display the image! Now sure how else to do that here.)

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

Changed to '14' - image still not showing up :(

Share this post


Link to post
Share on other sites
Simon    247
Simon

try `pagelines_before_header` for the adction

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

changed and... nothing - am open to other suggestions :)

Share this post


Link to post
Share on other sites
Simon    247
Simon

OK I will test and post working when I get home :)

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

OK - tried and still didn't work, then tried this on a regular page and it worked, so I'm going to guess it has to do something with this being a post page. Have been browsing settings and am not seeing what could be interfering. Deactivated all plugins. I originally had selected 'hide on posts page' for Site Branding - deselected that and made no difference.

Share this post


Link to post
Share on other sites
ocdee    0
ocdee

So close! When I first tried, I got nothing again. Then I noticed other sample code showing ?>/<?php, soooo, I stuck that in there and finally have an image - as you can see from the page though, my code tags aren't quite in the right place: http://patbarone.com/sandbox/?page_id=14 add_action( 'pagelines_before_header', 'add_my_header' ); function add_my_header() { global $post; if ( $post->ID === 626 ) ?> echo '<src="http://patbarone.com/sandbox/SRWL_banner.png">' <?php; }

Share this post


Link to post
Share on other sites
bonngean    0
bonngean

Dee, I did the same thing on my site but I did it with the templates instead of messing with extra code and add-ons. All I did was set my MAIN header file inside the global options. Then for my "home page" I used a different template, such as the Highlight Template, which allowed me to set a new header for the page, which was different for the blog post pages. Easy to set up in less than 5 minutes. My front page banner: http://www.plrproductions.com/ Post/Page page header: http://www.plrproductions.com/plr-articles/plr-news/ Notations: -- I used a Highlight Template for the home page (by using a static page, through Settings >> Reading) in Wordpress. -- I hid the site branding on this page, so that my Highlight banner was used as the masthead picture. The site is still under construction but you get the idea. :) Good luck with your site! --Bonnie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×