Multiple Site Banners
Allen
Registered Users Posts: 10,013 Major grins
From the beginning of NewSmug I've struggled with showing different banners for areas of my site.
After much prompting Smug finally added classes for CSS flow down, "parentnode". This helped
immensely as you could apply CSS to all children, sub-folders, galleries and pages, of a folder.
My first solution was adding all the different banners, single photo widgets, at the top of "entire site"
header. Then using CSS to hide/display on pages. This became a nightmare with positioning for
different browsers. But with much CSS it was basically solved.
I've now found what I think is a simpler solution. I add one HTML widget at the top of my header. I
leave the widget blank and add a background with CSS. Using this method all banners resize with
browser re-sizing.
EDIT: add this widget to the "entire site" header area of your site. It will then apply to every page of your site.
Couple of examples in CSS. Some of these have to be in order as the last applied overrides earlier CSS.
My family top folder flows down but I've added a different flow down starting in a family child sub-folder.
If you look at the <body> tag of sub-folders, galleries and pages they include all the "up the tree" "parentnode" class names.
After much prompting Smug finally added classes for CSS flow down, "parentnode". This helped
immensely as you could apply CSS to all children, sub-folders, galleries and pages, of a folder.
My first solution was adding all the different banners, single photo widgets, at the top of "entire site"
header. Then using CSS to hide/display on pages. This became a nightmare with positioning for
different browsers. But with much CSS it was basically solved.
I've now found what I think is a simpler solution. I add one HTML widget at the top of my header. I
leave the widget blank and add a background with CSS. Using this method all banners resize with
browser re-sizing.
EDIT: add this widget to the "entire site" header area of your site. It will then apply to every page of your site.
Couple of examples in CSS. Some of these have to be in order as the last applied overrides earlier CSS.
My family top folder flows down but I've added a different flow down starting in a family child sub-folder.
/* site wide -zsB4B is top of my site */ .sm-page-parentnode-zsB4B .sm-page-widget-12536016, /* flow down to everything below */ .sm-page-node-zsB4B .sm-page-widget-12536016 { /* top level folder */ background: url(/photos/i-snFwjZ3/1/XL/i-snFwjZ3.jpg) no-repeat; height: 154px; max-width: 1032px; margin: 0 auto !important; background-size: contain !important; } /* birds - individual pages plus bird folder */ .sm-page-node-gF9bt .sm-page-widget-12536016, /* videos */ .sm-page-node-6Hc2F .sm-page-widget-12536016, /* Recent Upload */ .sm-page-search .sm-page-widget-12536016, /* search */ .sm-page-node-6dSMX .sm-page-widget-12536016, /* Public Index */ .sm-page-node-J7sdG .sm-page-widget-12536016, /* keywords */ .sm-page-parentnode-Qm7v4 .sm-page-widget-12536016, /* flow down from bird folder to everything below */ .sm-page-node-Qm7v4 .sm-page-widget-12536016 { /* bird folder */ background: url(/photos/i-TCFHsP7/1/XL/i-TCFHsP7.jpg) no-repeat; height: 130px; max-width: 1024px; margin: 0 auto !important; background-size: contain !important; }BTW, "parentnode" does not include the folder, just children, so the folder also needs to be addressed.
If you look at the <body> tag of sub-folders, galleries and pages they include all the "up the tree" "parentnode" class names.
Tagged:
0
Comments
own banner. How about a family banner different from your public site pages.
All the code does is show how to apply a different background image to the banner "header html widget". The header area is only applicable to the "entire site".
My Website index | My Blog
I currently have my header set up using the "logo" widget. I want to use your method so I can vary the headers on my site (www.railroadphotographer.com). I set up an HTML box directly above the top menu bar and below my CSS box and I think I found all the proper references in the source code and set them up in my CSS at the top of the page. Nothing seems to be happening, though -- I've probably overlooked something in the CSS.
Once I get the CSS/HTML working properly, I will eliminate the logo widget from the site. Any help would be appreciated.
Thanks!!!!
The Railroad Photographer
www.railroadphotographer.com
Hmmm... I have been using your old way, I may need to spend some time looking at this. It's interesting, especially as just a month or so ago I went through adding yet another custom banner to sections of my site.
I actually do separate left/right custom banners, and as you said, keep them all present and turn different ones on and off. Small typos and suddenly I have none or too many.
But I'm also in need of similar features like "previous page" where it's not following the folder structure (i.e. what breadcrumbs do), and been wondering how to make that happen.
The fundamental issue IMO is that whoever did the inheritance should have permitted inheritance of customized pages below them. :cry
But thanks for this, and if you find more tricks like it please post.
sm-page-widget-139484
Is this it?
Can you post the CSS you used?
This adds a background.
.sm-page-widget-13948490 {
background: url(/photos/i-cnQKDJQ/0/150x100/i-cnQKDJQ-150x100.jpg) no-repeat;
height: 100px; max-width: 150px;
margin: 0 auto !important;
background-size: contain !important;
}
Create the whole image including text to simulate your current banner.
My Website index | My Blog
Open my site and watch my banner shrink in size.
My Website index | My Blog
Indeed it does, very nice. Mine has 3 across however, need to try and see what it can do with three elements and all with backgrounds. I still suspect I want to suppress 2 of them (on the sides) as it gets very small, but... I like it.
Keep looking. This looks a lot more maintainable!
That did it. I picked up the wrong reference to the HTML box from the source code. Now to tweak it until I like it!
Thanks!!!!!
The Railroad Photographer
www.railroadphotographer.com
I added the code and it works for one but not for another. EDIT: Okay, it works if the parent folder is set to "public." If the parent folder is set to "unlisted" it appears the banners do not flow down properly.
Here's my code:
/* site wide -4QrFm is top of my site */
.sm-page-parentnode-4QrFm .sm-page-widget-13948490, /* flow down to everything below */
.sm-page-node-35hnS .sm-page-widget-13948490 {
background: url(http://www.railroadphotographer.com/photos/i-KhR8nds/0/O/i-KhR8nds.jpg) no-repeat;
height: 100px; max-width: 1000px;
margin: 0 auto !important;
background-size: contain !important;
}
/* streetcar - individual pages plus streetcar folder */
.sm-page-parentnode-hpWgc .sm-page-widget-13948490, /* flow down from streetcar folder to everything below */
.sm-page-node-hpWgc .sm-page-widget-13948490 { /* streetcar folder */
background: url(http://www.railroadphotographer.com/photos/i-gNcGP4W/0/O/i-gNcGP4W.jpg) no-repeat;
height: 100px; max-width: 1000px;
margin: 0 auto !important;
background-size: contain !important;
}
/* lighthouse - individual pages plus lighthouse folder */
.sm-page-parentnode-rsQNL .sm-page-widget-13948490, /* flow down from lighthouse folder to everything below */
.sm-page-node-rsQNL .sm-page-widget-13948490 { /* lighthouse folder */
background: url(http://www.railroadphotographer.com/photos/i-vRLqFBz/0/O/i-vRLqFBz.jpg) no-repeat;
height: 100px; max-width: 1000px;
margin: 0 auto !important;
background-size: contain !important;
}
If you go to my main site, you get the site-wide banner:
http://www.railroadphotographer.com/browse
If you go to my streetcar trips page, you get a new banner. This flows down to the page below it:
http://www.railroadphotographer.com/Wilmington-Chapter-Trips
If you go to my lighthouse section (under construction), you get the new lighthouse banner. However, the galleries below it still have the site-wide banner:
http://www.railroadphotographer.com/FirstOrderLighthouse/n-rsQNL
What did I do wrong in the Lighthouse section that I did right in the streetcar trips section? EDIT: See my edit at the top of the page -- it doesn't work when the parent folder is set to "unlisted." Otherwise, it works. Never mind.
Thanks!
The Railroad Photographer
www.railroadphotographer.com
> Customize
> Content and Design
> Click SETTINGS button
> change header and footer settings
--- Denise
Musings & ramblings at https://denisegoldberg.blogspot.com