Help with a line on page.php

3 replies
Hi There,

I have recently had a Wordpress theme made that needs a slight improvement before it can be given away.

At the moment there is a problem line of code which needs to be changed for each site that it is installed on:

Code:
if($path== 'http://yourdomain.com/')
                            {
How do I change this so that it automatically finds the the site that it is on and if it is the home page?

Really appreciate your help

Pete
#line #pagephp
  • Profile picture of the author Unomateo
    Wordpress has a few of these

    is_home(), is_single(), is_page(), etc...

    so to see if you are on the home page you can do

    if(is_home())...
    Function Reference/is home « WordPress Codex
    {{ DiscussionBoard.errors[4685779].message }}
    • Profile picture of the author Peterdeg
      Originally Posted by Unomateo View Post

      Wordpress has a few of these

      is_home(), is_single(), is_page(), etc...

      so to see if you are on the home page you can do

      if(is_home())...
      Function Reference/is home « WordPress Codex
      Thanks Unomateo,

      Unfortunately that doesn't work with this theme. Oh well, it isn't that much hassle to change the URL round.

      Thanks for your help though

      Pete
      Signature
      {{ DiscussionBoard.errors[4689172].message }}
  • Profile picture of the author bhuthecoder
    use get_bloginfo('url') ,this will outputs homepage url
    more info:
    Code:
    http://codex.wordpress.org/Function_Reference/get_bloginfo
    {{ DiscussionBoard.errors[4689557].message }}

Trending Topics