- This topic has 51 replies, 4 voices, and was last updated 6 years, 6 months ago by Tom.
-
AuthorPosts
-
November 27, 2016 at 10:58 am #248354TomLead DeveloperLead Developer
You can use my Simple CSS plugin to add page specific CSS using the meta box. That might be your best bet:
body { background-color: #whatever; }
November 28, 2016 at 8:40 am #248756PaulWorks perfectly! Thank you
November 28, 2016 at 9:33 am #248800TomLead DeveloperLead DeveloperYou’re welcome ๐
December 6, 2016 at 8:04 pm #252146PaulSo far so good, and the menu background is looking great! (http://pastorschaller.com/tg1/)
But if I use an image below the menu, is there a way to have the top 20px of the image be the background for the brushed edge of the navigation?
Currently its like this on the ‘catering’ page – http://screencast.com/t/AP9hgmkQE2I
Thanks!
BTW, Ive worked with approx 15 themes in the last 2 years and GP is the most flexible, easiest and fastest.December 7, 2016 at 12:23 am #252189TomLead DeveloperLead DeveloperHmm, unfortunately it’s not possible for a background image to display outside of the element it’s attached to.
To have it “bleed” over the edge, the entire image (not repeated) would most likely need to be position inside the navigation element and set using position:fixed.
add_action( 'generate_inside_navigation','tu_image_navigation' ); function tu_image_navigation() { ?> <img class="nav-image" href="URL TO YOUR IMAGE" alt="" /> <?php }
Then your CSS:
.inside-navigation { position: relative; overflow-y: visible; } .nav-image { position: absolute; left: 0; bottom: -10px; }
Something along those lines might work.
December 7, 2016 at 6:48 am #252305PaulI assumed that I add the top piece of code to functions.php. Correct?
This is what I added to it:add_action( 'generate_inside_navigation','tu_image_navigation' ); function tu_image_navigation() { ?> <img class="nav-image" href="http://pastorschaller.com/tg1/wp-content/uploads/2016/11/chicken-tikka2.jpg" alt="" /> <?php }
I also added the CSS on the page. However the thin strip of background under the menu is not the image i specified.
This page has the extra CSS – http://pastorschaller.com/tg1/contact/Thanks,
PaulDecember 7, 2016 at 10:23 am #252409TomLead DeveloperLead DeveloperThe image you would be adding is actually the “torn” effect of the bottom of the navigation.
This would be added instead of adding that as the background image to the navigation.
December 8, 2016 at 6:33 am #252691PaulI added the torn effect image to functions.php
When you say.. ‘This would be added instead of adding that as the background image to the navigation’ does it mean I should remove it from ‘Background images > primary nav’ ?
I did try that but then I got this result – http://screencast.com/t/8lsnuYYDg
Thanks.December 8, 2016 at 10:53 am #252770TomLead DeveloperLead DeveloperYour menu items have a white square as a background image.
I just took a look at how the site you originally linked to does it – if you can put your torn image effect back as a background image (like it was before) and then let me know, I’ll try it their way using developer tools and will give you the CSS ๐
December 8, 2016 at 11:51 am #252792PaulAwesome.
Yes, I restored the background image.
OK to remove the php and css you previously gave in reply #252189 in this thread? or leave it in for now?
I can provide a WP login if that makes it easier for you
PaulDecember 8, 2016 at 8:11 pm #252880TomLead DeveloperLead DeveloperOk, so remove the white background from your menu items (to remove the squares around them).
Then in the “Before Header” hook, add an opening element:
<div class="header-container">
Then in the “After Header” hook, close it:
</div><!-- .header-container -->
Then you could do this:
body { padding-top: 200px; /* height of your header */ } .header-container { position: absolute; top: 0; left: 0; width: 100%; }
This will sit your header on top of your content below so it will overhang.
This means you can change the body background back to a global value as well.
Doing it this way is the same method your initial example is using.
December 9, 2016 at 6:12 am #252997PaulHi Tom
So I added the hooks:
http://screencast.com/t/N6c7jHcC9uI added the CSS only to the menu page for now (http://pastorschaller.com/tg1/menu/)
.header-container { position: absolute; top: 0; left: 0; width: 100%; }
As you can see the menu page header is transparent and the body content is at the very top
Can you see anything obvious that I did wrong?
Thanks for all your helpDecember 9, 2016 at 10:39 am #253053TomLead DeveloperLead DeveloperYou may need to add some padding to your body element – I just adjusted the CSS here: https://generatepress.com/forums/topic/sticky-menu-background-partially-transparent/page/2/#post-252880
December 10, 2016 at 6:58 am #253294PaulTom
I added the following CSS to the ‘menu’ page, but the nav BG image is not overhanging.
My header and primary nav backgrounds are transparent (no color specified).If I decrease the top padding to 140 in the CSS you can see the result here:
http://pastorschaller.com/tg1/contact/
The BG image for the nav does not overhangbody { padding-top: 165px; /* height of your header */ } .header-container { position: absolute; top: 0; left: 0; width: 100%; }
Thanks
PaulDecember 10, 2016 at 10:53 am #253324TomLead DeveloperLead DeveloperThe
.header-container
element doesn’t seem to exist on that page. -
AuthorPosts
- You must be logged in to reply to this topic.