Site logo

Archived topic

fixed header-slider in background

29 replies · Started by Frederik on August 12, 2015

Viewing posts 16–30 of 30

...just did soe more testing and found a possible solution (maybe quick&dirty, but seems to work)

added following code to GP-hook BEFORE HEAD

<?php if (is_front_page() and is_home() ) : ?>
<div id="metaslider-background" style="position:fixed;width:100%;height:100%;z-index:-1;top:0;left:0;">
<?php echo do_shortcode("[metaslider id=123 percentwidth=100]"); ?>
</div>
<?php endif; ?><div id="content-pushdown" style="width:100%;height:100vh;top:0;left:0;">
</div>

im am not sure if i really like it, but anyway already implemented here:
http://dogsbestfriends.de

Hi Frederik,

thank your for your help!

Actually I installed the metaslider plugin and added a diashow. Also hooked your code (with the correct slider-ID)... BUT: the metaslider does not appear in the background of my start page - no matter where I hook the code!

It's obvious, that the code has an impact on the page: depending where I hook it, the starting text (in green letters: "fudiggl.de gugge...") goes to different places. Only the slider does not appear!

On a regular page the slider itself works normally... so the plugin works and the ID is correct, too.

Any idea(s)/suggestion(s)?

Sven

@Frederik: perhaps you can send me your adjustments in meta-slider for the slideshow on your starting page...?
webmaster at fudiggl dot de

Sven,

hast du im GP-Hook das Häkchen gesetzt, dass auch php-code verarbeitet wird ?

und im code musst du den string <?php endif; ?> verschieben und ganz ans Ende setzen, sonst wird auch bei allen anderen Seiten der eigentliche Inhalt der Webseite nach unten veschoben.

Hi Frederik,

let's stay in English, please, so Tom can follow...

The GP-hook-section is activated, so the PHP-Code works (as mentioned above: depending where I hook your code (before-header, in-header, in-content et. al.) the start page changes. But the slider does not show up in the background! There only is the standard background image I have set for any page.

I don't see how to put the <?php endif; ?> at the end... with your code it already is at the end!

Can it be a problem with the slider itself? I have already tried another slider plugin...same problem. So I assume, I have to play around with some PHP-code or CSS?!

????

Any language is good! Google Translate is awesome :)

Any chance you can post a link to your site?

Custom CSS, that perhaps/certainly affects the background:

/* set beackground texture */
body {
background-image:url('http://www.fudiggl.de/wp-content/uploads/betonwand_hintergrund-1.jpg');
background-repeat:repeat;
background-attachment:scroll;
background-clip:border-box;
background-position: 0px 0px;
background-size: auto;
}

/* Hide menu on start page (id = nnn) and show when scrolling as recommended by Tom */
.page-id-nnn .main-navigation {
display: none;
}
.page-id-nnn .main-navigation.navigation-clone {
display: block;
}

Where did you add the slider? I'm not seeing it in the source.

hooked it before the header:

<?php if ( is_front_page() and is_home() ) : ?>
   <div id="metaslider-background" style="position:fixed; width:100%; height:100%; z-index:-1; top:0;l eft:0;">
      <?php echo do_shortcode("[metaslider id=6490 percentwidth=100]"); ?>
   </div>
<?php endif; ?>

Try this:

<?php if ( is_front_page() ) : ?>
   <div id="metaslider-background" style="position:fixed; width:100%; height:100%; z-index:-1; top:0;l eft:0;">
      <?php echo do_shortcode("[metaslider id=6490 percentwidth=100]"); ?>
   </div>
<?php endif; ?>

And make sure "Execute PHP" is checked.

A W E S O M E ! ! !

:-*

well done, TOM! Good to know that Home is not always Home !

Thank you both for your efforts! It's working now... you can have a look at:

http://www.fudiggl.de

(I'm one of the drummers)

Best wishes to you!

Sven

Site looks great!

is_home() is kind of misleading - it applies to the "posts page" or blog of your site, not necessarily the home page.

It's an old function that WP keeps around for backwards compatibility.

This archived topic is closed to new replies.