Support » Themes and Templates » Different header on Home Page only
Different header on Home Page only
-
Hi guys,
I would really appreciate some help.
I am using theme twentyeleven.
I installed Cyclone slider, created a slide show and I inserted it in header.php which looks like this:<?php echo do_shortcode(‘[cycloneslider id =”292″]’); ?>
However, I need this slide show only on Home Page. The rest of the pages I need to see the header which I have already uploaded under the Theme Settings in Header section.
I tried the following code but it did not work:
<?php
if ( is_home() ) {?>
<header >
<div id=”[cycloneslider id =”292″]”> </div>
</header><?php
}else {?>
<header >
<div id=”293″> </div>
</header><?php
<?php }
?>Just to let you know – I am not a coder, I understand nothing of coding. Will really appreciate some help.
-
inserted it in header.php which looks like this:
please post the full code of header.php (possibly use the pastebin – http://codex.wordpress.org/Forum_Welcome )
Here you are, thanks for looking into it:
change this section:
<?php echo do_shortcode('[cycloneslider id ="292"]'); ?> <?php // Check to see if the header image has been removed $header_image = get_header_image(); if ( $header_image ) :
to:
<?php if ( is_home() ) : echo do_shortcode('[cycloneslider id ="292"]'); ?> <?php // Check to see if the header image has been removed $header_image = get_header_image(); elseif ( $header_image ) :
i.e. add the
if( is_home() ) :
for the slideshow,
and change the
if( $header_image ) :
to
elseif( $header_image ) :
Hi,
I changed it and now I see no header or slideshow at all. It seemed that it removed the entire header section, I can only see the horizontal menu bar now.
Any other ideas?changed it and now I see no header or slideshow at all.
please post the full code of the header.php as it is with your edits.
Here you are:
my mistake;
change the section to:
<?php // Check to see if the header image has been removed $header_image = get_header_image(); if ( is_home() ) : echo do_shortcode('[cycloneslider id ="292"]'); elseif ( $header_image ) :
the full header.php should look like: http://pastebin.com/q0NK9USf
if you have a static front page, use
is_front_page()
instead of
is_home()
I am afraid this did not solve it. I copied and pasted the entire code you provided for header.php and now I lost the slide show. When I inserted the slide show with this code as shown above,
<?php echo do_shortcode(‘[cycloneslider id =”292″]’); ?>
again I am back to square one. I get the slideshow on all pages, not only on home page.
So, I removed this code and left only what you gave me as content but I have no slideshow now.
I’ll try not to cause confusion; so for now ignore the header image, and try to get the slideshow just on the front page.
When I inserted the slide show with this code as shown above,
<?php echo do_shortcode('[cycloneslider id ="292"]'); ?>
again I am back to square one. I get the slideshow on all pages, not only on home page.
can you do this?
do you have a static front page, or the posts page on the front?
for a static front page, change the slideshow line to:
<?php if( is_front_page() ) echo do_shortcode('[cycloneslider id ="292"]'); ?>
for the posts page on the front, change the line to:
<?php if( is_home() ) echo do_shortcode('[cycloneslider id ="292"]'); ?>
Yes, it was a static front page and it is now resolved only by inserting this in the original header.php:
<?php if( is_front_page() ) echo do_shortcode(‘[cycloneslider id =”292″]’); ?>
Thanks a lot!!
- The topic ‘Different header on Home Page only’ is closed to new replies.