Page 1 of 2

How to make the sliding header appear on every page?

PostPosted: Wed Feb 04, 2009 3:30 am
by clunsford
I found the earlier post which gave these instructions to allow the sliding images to appear on each page:

You delete the entire line line 36 in the header.php file that contains if(is_home) or (is_category)
You also delete the last line, line 57.
These two lines tell the image heading to display only on the front page and the category page.

another option is to change line 36 to read:
(if(is_page))

wayne
Site Admin


I tried both options and ended up with my blog page(s) not even visible. Not being familiar with php it is likely I accidently deleted a bracket or something. One other issue I have problems with is knowing which line is number 36, 57, or even 107.

Any help would be greatly appreciated.

Re: How to make the sliding header appear on every page?

PostPosted: Wed Feb 04, 2009 3:50 am
by ewh
post your code so we can look at it

Re: How to make the sliding header appear on every page?

PostPosted: Wed Feb 04, 2009 3:44 pm
by clunsford
Here's the Header code right off the Theme Editor:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><?php
$replacethese = array('[',']');
$replacewith = array(' ',' ');
echo str_replace($replacethese, $replacewith, get_bloginfo('title')); ?>



<?php if ( !(is_404()) && (is_single()) or (is_page()) or (is_archive()) ) { ?> &raquo; <?php wp_title(''); ?><?php } ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_head(); ?>


<?php $url = get_stylesheet_directory_uri()?>
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $url; ?>/imagemenu/imageMenu.css">
<script type="text/javascript" src="<?php echo $url; ?>/imagemenu/mootools.js"></script>
<script type="text/javascript" src="<?php echo $url; ?>/imagemenu/imageMenu.js"></script>



</head>

<body>

<div id="wrapper">

<div id="welcomeheading">
<h1><a href="<?php bloginfo('url'); ?>/">

<?php $replacethese = array('[',']');
$replacewith = array('<span id="middleword">','</span>');
echo str_replace($replacethese, $replacewith, get_bloginfo('title')); ?>
</a></h1>
</div>
<div class="description"><?php bloginfo('description'); ?></div>
<?php if( (is_home()) or (is_category())) { ?>

<div id="imageMenu">
<ul>
<li class="bk1"><a href="<?php bloginfo('url'); ?>/?cat=1">Category 1</a></li>
<li class="bk2"><a href="<?php bloginfo('url'); ?>/?cat=2">Category 2</a></li>
<li class="bk3"><a href="<?php bloginfo('url'); ?>/?cat=3">Category 3</a></li>
<li class="bk4"><a href="<?php bloginfo('url'); ?>/?cat=4">Category 4</a></li>
<li class="bk5"><a href="<?php bloginfo('url'); ?>/?cat=5">Category 5</a></li>
<li class="bk6"><a href="<?php bloginfo('url'); ?>/?cat=6">Category 6</a></li>
<li class="bk7"><a href="<?php bloginfo('url'); ?>/?cat=7">Category 7</a></li>
</ul>
</div>

<script type="text/javascript">

window.addEvent('domready', function(){
var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){location=(e);}});
});
</script>

<?php } ?>

Re: How to make the sliding header appear on every page?

PostPosted: Thu Feb 05, 2009 8:35 pm
by ewh
This looks like the standard header.php file from the theme. If not, just revert back to the original and make the changes detailed below. The block of code in the header.php file tells it to only show the images if the current content is a page or a category:

Code: Select all
<?php if( (is_home())  or (is_category())) { ?>

<div id="imageMenu">
         <ul>
            <li class="bk1"><a href="<?php bloginfo('url'); ?>/?cat=1">Category 1</a></li>
            <li class="bk2"><a href="<?php bloginfo('url'); ?>/?cat=2">Category 2</a></li>
            <li class="bk3"><a href="<?php bloginfo('url'); ?>/?cat=3">Category 3</a></li>
            <li class="bk4"><a href="<?php bloginfo('url'); ?>/?cat=4">Category 4</a></li>
            <li class="bk5"><a href="<?php bloginfo('url'); ?>/?cat=5">Category 5</a></li>
            <li class="bk6"><a href="<?php bloginfo('url'); ?>/?cat=6">Category 6</a></li>
            <li class="bk7"><a href="<?php bloginfo('url'); ?>/?cat=7">Category 7</a></li>
         </ul>
         </div>
      
<script type="text/javascript">
         
         window.addEvent('domready', function(){
            var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){location=(e);}});
         });
      </script>   

<?php } ?>


To make this show for all content, you can do one of two things.
1) This is the suggested method. Change the line that has this:
Code: Select all
<?php if( (is_home())  or (is_category())) { ?>

to this:
Code: Select all
<?php if( (is_home())  or (is_category()) or (is_page()) or (is_single()) ) { ?>


2) Comment out the two lines of php code that limit the content types (scroll all the way down to see last commented line):
Code: Select all
<!-- -ewH comment out first line of php code- <?php if( (is_home())  or (is_category())) { ?> -->

<div id="imageMenu">
         <ul>
            <li class="bk1"><a href="<?php bloginfo('url'); ?>/?cat=1">Category 1</a></li>
            <li class="bk2"><a href="<?php bloginfo('url'); ?>/?cat=2">Category 2</a></li>
            <li class="bk3"><a href="<?php bloginfo('url'); ?>/?cat=3">Category 3</a></li>
            <li class="bk4"><a href="<?php bloginfo('url'); ?>/?cat=4">Category 4</a></li>
            <li class="bk5"><a href="<?php bloginfo('url'); ?>/?cat=5">Category 5</a></li>
            <li class="bk6"><a href="<?php bloginfo('url'); ?>/?cat=6">Category 6</a></li>
            <li class="bk7"><a href="<?php bloginfo('url'); ?>/?cat=7">Category 7</a></li>
         </ul>
         </div>
      
<script type="text/javascript">
         
         window.addEvent('domready', function(){
            var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){location=(e);}});
         });
      </script>   

<!-- -ewH comment out second line php code- <?php } ?> -->

Re: The two options suggested by ewh

PostPosted: Sat Feb 21, 2009 9:08 pm
by HardGainer
I'm setting up a blog using the sliding door theme right now and have the same requirement.

I don't think the second option above was tested ;)

You cannot disable interpreting of php code simply by placing html comment tags around it. The code still gets executed; it just means that any output within the bounds of the comment tag pair will not be displayed by the browser.

Thus:
Code: Select all
<!-- <?php echo 'this is a comment' ?> -->
still sends
Code: Select all
<!-- this is a comment -->
to the browser, not
Code: Select all
<!--  -->


The first option (including all document types in the conditional statement) or removing the condition altogether are viable solutions.

Re: The two options suggested by ewh

PostPosted: Sun Feb 22, 2009 3:59 am
by ewh
HardGainer wrote:I don't think the second option above was tested ;)

Oops, good catch...

1) Yes you are right that I didn't test option 2
2) Again you are right that this wont work :)

So if someone wants to do option 2, its probably best just to remove the php code altogether as suggested:
Code: Select all
<div id="imageMenu">
         <ul>
            <li class="bk1"><a href="<?php bloginfo('url'); ?>/?cat=1">Category 1</a></li>
            <li class="bk2"><a href="<?php bloginfo('url'); ?>/?cat=2">Category 2</a></li>
            <li class="bk3"><a href="<?php bloginfo('url'); ?>/?cat=3">Category 3</a></li>
            <li class="bk4"><a href="<?php bloginfo('url'); ?>/?cat=4">Category 4</a></li>
            <li class="bk5"><a href="<?php bloginfo('url'); ?>/?cat=5">Category 5</a></li>
            <li class="bk6"><a href="<?php bloginfo('url'); ?>/?cat=6">Category 6</a></li>
            <li class="bk7"><a href="<?php bloginfo('url'); ?>/?cat=7">Category 7</a></li>
         </ul>
         </div>
     
<script type="text/javascript">
         
         window.addEvent('domready', function(){
            var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){location=(e);}});
         });
      </script>   

Re: How to make the sliding header appear on every page?

PostPosted: Mon Mar 09, 2009 9:24 pm
by kriss
option one works. thanks!

Re: How to make the sliding header appear on every page?

PostPosted: Mon Dec 14, 2009 7:38 pm
by Katrina
I want to do the opposite and have the sliding navigation NOT show up on my homepage only.

What and where do I change?

Re: How to make the sliding header appear on every page?

PostPosted: Thu Jan 28, 2010 2:00 pm
by crossing
I would like to only have the sliding header show up on my blog page, which is not my home (static) page. Does anyone know how to do that? (I realize this is the opposite problem from what this post started as, but maybe one of you can answer my question!) What is the code I need to insert to do that?

I changed:
<?php if( (is_page)){ ?>

to:
<?php if(is_page('blog') ){ ?>

And now it doesn't show up on any of the pages at all. Help?

P.S. If that problem isn't fixable, can someone help me at least change the code so the sliding header does NOT show up on my home page but does show up on the other pages?

Re: How to make the sliding header appear on every page?

PostPosted: Thu Jan 28, 2010 2:50 pm
by crossing
Katrina, I don't if you're still around, but I figured out how to not have it show up on the homepage... An "if, then" statement. Place this code at the end of your header.php. It basically says, if you click on the front page, nothing happens. If you click any other page, the sliding door menu pops up.

<?php
if (is_front_page())
{?>

<?php } else { ?>

<div id="imageMenu">
<ul>
<li class="bk1"><a href="<?php bloginfo('url'); ?>/?cat=1">Category 1</a></li>
<li class="bk2"><a href="<?php bloginfo('url'); ?>/?cat=2">Category 2</a></li>
<li class="bk3"><a href="<?php bloginfo('url'); ?>/?cat=3">Category 3</a></li>
<li class="bk4"><a href="<?php bloginfo('url'); ?>/?cat=4">Category 4</a></li>
<li class="bk5"><a href="<?php bloginfo('url'); ?>/?cat=5">Category 5</a></li>
<li class="bk6"><a href="<?php bloginfo('url'); ?>/?cat=6">Category 6</a></li>
<li class="bk7"><a href="<?php bloginfo('url'); ?>/?cat=7">Category 7</a></li>
</ul>
</div>

<script type="text/javascript">

window.addEvent('domready', function(){
var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:0, onOpen:function(e,i){location=(e);}});
});
</script>

<?php } ?>


BUT I STILL DON'T KNOW HOW TO PUT THE SLIDING HEADER ONLY ON MY BLOG PAGE!!! Hope someone can help me out :)