Jump to content


Photo
- - - - -

Different header on post page only


  • Please log in to reply
18 replies to this topic

#1 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 24 March 2011 - 12:03 PM

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

Please Login or Register to see this Hidden Content

Post page is here... I hid branding for post pages and now want that banner above the navigation.

Please Login or Register to see this Hidden Content

Was playing with hooks, but apparently, (beyond moving a search bar per the demo) can't quite wrap my head around it yet. Thanks!

#2 Kate

Kate

    Advocate

  • Members
  • 3039 posts

Posted 24 March 2011 - 01:26 PM

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

#3 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 24 March 2011 - 04:58 PM

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

#4 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 24 March 2011 - 05:26 PM

Thanks for the reply Kate :) I have the image on

Please Login or Register to see this Hidden Content

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?

#5 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 24 March 2011 - 05:33 PM

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

#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 24 March 2011 - 06:04 PM

That might just work - seems like it would grab that image for all pages though...

Easy, add a conditional ;)
`if ( is_page('slug') ) echo '';`

use this in the snippet I gave you before, replacing `slug` with the page slug you want it to appear on.

#7 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 24 March 2011 - 11:50 PM

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

Please Login or Register to see this Hidden Content



Please Login or Register to see this Hidden Content

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

#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 24 March 2011 - 11:54 PM

You can use ID, slug or page title, so looking at your link `http://patbarone.com/sandbox/?page_id=14` its `if ( is_page('14') ) echo '';`

#9 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 24 March 2011 - 11:59 PM

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

#10 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 25 March 2011 - 12:04 AM

try `pagelines_before_header` for the adction

#11 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 25 March 2011 - 12:17 AM

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

#12 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 25 March 2011 - 12:21 AM

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

#13 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 25 March 2011 - 02:21 AM

Simon, thank you so much!

#14 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 25 March 2011 - 07:04 PM

Dee, this snippet 100% works:

Please Login or Register to see this Hidden Content

just change the number to your page ID

#15 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 25 March 2011 - 10:51 PM

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.

#16 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 25 March 2011 - 11:30 PM

Didnt realise it was a post! OK try this:

Please Login or Register to see this Hidden Content



#17 ocdee

ocdee

    Member

  • Members
  • PipPip
  • 22 posts

Posted 26 March 2011 - 12:13 AM

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:

Please Login or Register to see this Hidden Content

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; }

#18 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 26 March 2011 - 12:53 PM

add_action( 'pagelines_before_header', 'add_my_header' ); function add_my_header() { global $post; if ( $post->ID === 626 ) { ?> <`img` src="http://patbarone.com/sandbox/SRWL_banner.png" /> <?php }

#19 bonngean

bonngean

    Advanced Member

  • Members
  • PipPipPip
  • 82 posts

Posted 26 March 2011 - 03:51 PM

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:

Please Login or Register to see this Hidden Content

Post/Page page header:

Please Login or Register to see this Hidden Content

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