Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 11th May 2009, 10:49 AM   #1
I.C.Hope
War Room Member
 
Intrepreneur's Avatar
 
Join Date: 2009
Posts: 2,777
Thanks: 457
Thanked 275 Times in 208 Posts
Default
If statement PHP.. Wordpress
Share on: 
fb share twitter share gplus share more share

Ok Im using this

Code:
<?php if(is_home()) : ?>
<h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
<?php else : ?>
<span id="blogTitle">
<a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a>
</span>
<?php endif; ?>
On My wordpress blog...

My homepage is a static wordpress page, so I need the blog title to be at least included on that page.

It includes my blog title but doesnt put it in the code on that page or any other page.

it's good that it's removed everything from my other pages as now I have a nice clean <H1>

But for the homepage I want it to at least include this, any ideas..

What I do to that code to make it right?

Oh the homepage is set via General settings in wordpress back office, so that it is the statci page I've selcted it to be.

It is called home but i guess the if statement is wrong because it isn't picking it up.

Cheers

Intrepreneur is offline  
Unread 11th May 2009, 11:12 PM   #2
Active Warrior
War Room Member
 
tunasalad's Avatar
 
Join Date: 2009
Posts: 37
Thanks: 11
Thanked 5 Times in 5 Posts
Default
Re: If statement PHP.. Wordpress
Share on: 
fb share twitter share gplus share more share

Try this out instead:

<?php if(is_home()) { ?>
<h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
<?php } else { ?>
<span id="blogTitle">
<a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a>
</span>
<?php } ?>


the open and close braces are key. wrap them around the entire contents of your if and else clauses.
tunasalad is offline  
Unread 12th May 2009, 07:08 AM   #3
Active Warrior
War Room Member
 
Join Date: 2009
Location: Maidens, VA
Posts: 42
Thanks: 21
Thanked 12 Times in 9 Posts
Default
Re: If statement PHP.. Wordpress
Share on: 
fb share twitter share gplus share more share

I'm not quite sure exactly what you mean in your description, but as for the code, have you tried replacing is_home() with is_front_page()? Is_front_page will handle a home page that is either a page or a post listing (default wordpress).
esoomllub is offline  
The Following User Says Thank You to esoomllub For This Useful Post:
Unread 12th May 2009, 07:51 AM   #4
Active Warrior
War Room Member
 
Join Date: 2009
Location: Maidens, VA
Posts: 42
Thanks: 21
Thanked 12 Times in 9 Posts
Default
Re: If statement PHP.. Wordpress
Share on: 
fb share twitter share gplus share more share

I can't post links here yet (until I get to 15 posts), but if you search at google for "wordpress developer documentation" the first result will be their documentation.

I sometimes find it less than easy to use. I often find that a google search for "wordpress" and then the function I am looking to find out about usually will put me at the right place within their documentation quicker.
esoomllub is offline  
The Following User Says Thank You to esoomllub For This Useful Post:
Closed Thread


Bookmarks

Tags
php, statement


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:01 AM.