Jump to content
Sign in to follow this  
basmati

Different Header Images by IDs via CSS

Recommended Posts

basmati

I've got different headers for pages. Thats easy with CSS, but i have to declare every new page header by ID (see CSS below). Now my question: Is there a way to tell the system to use a special header for all subpages without declaring the new page IDs in the CSS (or with a hook)? Would be more CMS like.

#header, .page-id-24 #header, .page-id-32 #header, .page-id-34 #header, .page-id-52 #header,
	.parent-pageid-24 #header, .parent-pageid-32 #header, .parent-pageid-34 #header, .parent-pageid-52 #header {
	background: url("images/header-start.jpg") no-repeat scroll 0 4.2em transparent;
	height: 253px;
	}
	

Share this post


Link to post
Share on other sites
catrina
Hm, I'm not sure there is a way to do this. So far adding the page IDs in the CSS is the easiest solution, but perhaps someone can provide more insight on any other possible hack.

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
Rob
Catrina is correct. To the best of my knowledge, there is no way to do this, but it doesn't mean that it couldn't be done by a programmer. Unfortunately, that's outside the scope of forum support and so I suggest you consider hiring someone by writing to [b]hello@pagelines.com[/b]. Changing the header image is a very cool thing visually, however you may be unaware that it will hurt you if there is advertising on your site. Ad tools do not only search for relevant content, but they also look for background colors and even image colors to match up the ad to the site so they do not look mismatched. I say this because on the first of December, I changed the background of my header and my ad revenues dropped by more than 60%. It can take the adbots more than 60 days to become accustomed to new header images (background colors are faster). I do not know of any plugins that will work for this as each company designs their theme, platform or in our case, framework uniquely.

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
basmati
ok, i understand, that question reaches to far for simple forum support. but users are still allowed to exchange ideas - right? finding a solution could be interesting for other pagelines users. inspired by a suggestion from another forum, i try to merge that idea for a solution within the pagelines template system. so, what about the idea of generating classes for page-tree-ids? idea: creating a new "template.header.php" in base. change line 23 to: [code]ID),get_ancestors($post->ID,'page'))); ?> >[/code] would that be possible? PlatformPro 1.5.3

Share this post


Link to post
Share on other sites
catrina
It doesn't sound like a far-fetched idea. You can try it to see if it works and if it doesn't, experiment further.

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
basmati
i don't think so. for wordpress themes there are solution for this function available. but i still don't understand the pagelines template system...

Share this post


Link to post
Share on other sites
Danny
Hi Basmati, Can you you provide a link to this Wordpress solution, so I can test it out for you.

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
basmati
thanks danny, here's the link: http://bmsgmbh.de Check the different css page templates - on the main navigation.

Share this post


Link to post
Share on other sites
Jenny
I asked @pross what you could use and he suggested giving the filter pagelines_logo_url a shot using is_page(). You look like you're pretty good with PHP so hopefully this points you in the right direction. :)

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
basmati
oh thanks, but i only have basic knowledge, i'am just fast putting things together. as mentioned above this solution was inspired from another forum. could you just explain that idea in detail?

Share this post


Link to post
Share on other sites
Jenny
Oh trust me, you don't want me writing PHP code for your site. It won't work at all. ;) But we have a few people here who know PHP so hopefully they will be able to help.

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
kastelic
Snippet 3 on this page: http://codex.wordpress.org/Conditional_Tags seem to be doing what you are looking for, basically testing to see if you are on a given page or a child of that given page. Then it sets a variable of your banner image. You could conclude it by adding style tags at the end that would set the background to the variable.

Share this post


Link to post
Share on other sites
basmati
This function from snippet 4 on the Conditional_Tags Page seems to be even more easy: [code]function is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath global $post; // load details about this page if ( is_page($pid) ) return true; // we're at the page or at a sub page $anc = get_post_ancestors( $post->ID ); foreach ( $anc as $ancestor ) { if( is_page() && $ancestor == $pid ) { return true; } } return false; // we arn't at the page, and the page is not an ancestor } [/code]

Share this post


Link to post
Share on other sites
basmati
or that: [code]function is_subpage() { global $post; // load details about this page if ( is_page() && $post->post_parent ) { // test to see if the page has a parent return $post->post_parent; // return the ID of the parent post } else { // there is no parent so ... return false; // ... the answer to the question is false } } [/code] I think i simply need a hook that returns the ID of a parentpage to the child pages and even to the child pages of the child page. Example: Parent page (with header image defined in css) - child page (same parent page header image) -- child of the child page (same parent page header image)

Share this post


Link to post
Share on other sites
Rob
I've asked a developer to look into this issue for you.

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
Rob
Our developer returned to say that you need a function, not a just a hook to return the page ID. He strongly urged that you'll need a programmer or one of our Pros to assist with this as it goes beyond the scope of what we can do in the forum. Would you mind writing to hello@pagelines.com for a quote? I'm sure one of our professional team can assist you. Thanks.

Former PageLines Moderator, Food Expert and Raconteur

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  

×