Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Using is_front_page() in the ATO - Configure Header Area option? (http://forum.bytesforall.com/showthread.php?t=4782)

david y Dec 9, 2009 05:33 AM

Using is_front_page() in the ATO - Configure Header Area option?
 
I am trying to configure the header area differently based on whether it's the front page or not. Can I use the is_front_page() function here along with the %logo %bar1 %pages %image items on the ATO page?

i.e-

on the front page I want %bar1 %logo %bar1 %pages %image. On all others I want %bar1 %logo %bar1 %image %pages %bar2. Seems like it should work, but I'm a newbie and my coding isn't working right.

Thank you

juggledad Dec 9, 2009 09:26 AM

exactly what did you code?

david y Dec 9, 2009 09:47 AM

Well I tried this in the Configure Header Area -

<?php if ( is_front_page() ){%bar1 %bar1 %logo %bar1 %pages %bar1 %image};
else {%bar1 %bar1 %logo %bar1 %image %pages %bar1 }; ?>

and of course that didn't work. After further thinking I realized that this is probably not the right spot to be having code, but I don't know. Like I said, I'm all new to this. Any help is appreciated. Thank you

juggledad Dec 9, 2009 12:00 PM

yeah, you can't do it that way. Try this
HTML Code:

<?php if ( is_front_page() ){ ?> %bar1 %bar1 %logo %bar1 %pages %bar1 %image <?php };
else { ?>
%bar1 %bar1 %logo %bar1 %image %pages %bar1 <?php }; ?>


david y Dec 9, 2009 12:20 PM

juggledad -

I tried putting that in the HTML Inserts: Header and it didn't work for me. I tried putting it in the Configure Header Area and that didn't work for me.

Where should this code be placed? Thanks, :confused:

juggledad Dec 9, 2009 12:32 PM

this should work, put it in 'Configure Header Area'
HTML Code:

<?php if ( is_front_page() ){ echo '%bar1 %bar1 %logo %bar1 %pages %bar1 %image'; }
else { echo' %bar1 %bar1 %logo %bar1 %image %pages %bar1'; }; ?>


david y Dec 9, 2009 12:51 PM

that did the trick, thank you!

david y Dec 9, 2009 01:28 PM

juggledad -

1 more question if I may -

if I wanted to use the Dynamic Headers plugin on all pages except the front page (I like the Ata rotating header on the front page), how would I replace the '%image' in your code with <?php show_media_header(); ?>.

juggledad Dec 9, 2009 01:32 PM

try this
HTML Code:

<?php if ( is_front_page() ){ echo '%bar1 %bar1 %logo %bar1 %pages %bar1 %image'; }
else { echo' %bar1 %bar1 %logo %bar1'; show_media_header(); echo '%pages %bar1'; }; ?>


david y Dec 9, 2009 01:42 PM

the code you sent me yesterday for the headers works great, but for
some reason I get an 'error on page' message when I go to the pages
with the dynamic headers.

Webpage error details -

Message: Object required
Line: 51
Char: 3
Code: 0

This is the source code -

Line 48: function RotateHeaderImages(){
Line 49: if (document.body){
Line 50: HeaderImageContainer =
document.getElementById('imagecontainer');
Line 51: HeaderImageContainer.style.background =
'url(' + HeaderImages[j] + ') top center no-repeat';
Line 52: j = j + 1
Line 53: if (j > (p-1)) j=0
Line 54: t = setTimeout('RotateHeaderImages()', 10000)

If I just use the dynamic header code without the if..else code
there is no error. Any idea as to what this is?

juggledad Dec 10, 2009 03:53 PM

I just installed the plugin and tested using the code I gave above and it works fine for me.
try deactivating all but that plugin.

david y Dec 10, 2009 04:15 PM

I deactivated everything and I still get the error.

I'll bet "Header Image>> Rotate Header Image w/ Java Script?" is set to 0 on your setup. If you set it to rotate the header image you should get the same error I am getting

juggledad Dec 10, 2009 05:31 PM

nope, what is your url

david y Dec 13, 2009 01:02 PM

www.yba.com/default

juggledad Dec 13, 2009 05:31 PM

what page shows the error?

david y Dec 13, 2009 05:57 PM

on my browswe (ie8) it get the page error on every page exceptthe front page. Could it be a setting on my browser??

juggledad Dec 14, 2009 04:50 AM

FOUND IT! Your image is looking for the localhost
HTML Code:

src="http://localhost/yba/wp-content/uploads/2009/11/SlidingDoor2_1500-300x258.jpg
you need to fix this

The error was there in Safari, the image came up with a ? and I wasn't thinking.

david y Dec 16, 2009 08:52 AM

actually that's not the error I'm in reference to. In Explorer, at the bottom left corner it says there is an error on every page except the frontpage. If you look at the source code that the error references, its the rotating header code. If I turn off the rotating feature the error goes away. If I don't use the if...else code from earlier in this thread and have rotating header on, the error goes away. Strange.

juggledad Dec 22, 2009 06:00 AM

the problem is caused by this statement
PHP Code:

HeaderImageContainer.style.background 'url(' HeaderImages[j] + ') top center no-repeat'

it's because IE doesn't like the '.'s in the variable name.

I'll take a look later to see if I can find out why IE doesn't like it (don't you love browser compatibility)

david y Dec 22, 2009 12:26 PM

thanks very much for checking it out.


All times are GMT -6. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.