WordPress.org

Ready to get started?Download WordPress

Forums

Check if main page - outside index.php (3 posts)

  1. kreso777
    Member
    Posted 4 years ago #

    Okay - I know I can check if it is the main page with
    <?php if (is_home()) { echo "ohai"; }?>
    But it only works on index.php or main page of the template, it's no good elsewhere.
    I'd need that in other template files (footer.php to be exact).

    $_SERVER['PHP_SELF'] came to my mind, but it's no good with WordPress since current script is always index.php.

    Any other solutions? :/

  2. terriann
    Member
    Posted 4 years ago #

    $_SERVER['REQUEST_URI'] may help you.

    I also know that is_home() or is_index() (I can't remember if that one is real though...) work in the functions.php file.

    Specifically what file are you trying to add that decision to? Then we may be of more help to you.

    - Terri

  3. kreso777
    Member
    Posted 4 years ago #

    I'll try with request uri tomorrow, ty.
    is_index() doesn't exist, is_home() doesn't work, as I said above... :/

    Hokay, here's more info:
    My site is here: http://www.serijala.com/
    I'm using a free theme / template, so I'm still not that familiar with ins and outs of the template (and WP for that matter). The main template file seems to be home.php, I'm trying to put that decision into footer.php.

    I can't put it directly into home.php becase of the way theme is coded - what I want to do is put <div>...</div> above my site's footer, full width. So footer.php is the only option I can see...

Topic Closed

This topic has been closed to new replies.

About this Topic