• I’m admittedly new to WordPress, and I’m trying to use is_home() and is_front_page() or a combination of the two in my header in order to display a Flash object on the front page and a smaller header on all other pages. This works just fine on my desktop, but when I upload my theme to the subdirectory where it will be hosted, this does’t seem to work any more.

    Is it because index.php is located in a subdirectory? As of now, WordPress needs to function entirely within the subdirectory and the urls should reflect this. I tried adding wp_reset_query() before the if statement and that didn’t work. Any work arounds?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter lukemj

    (@lukemj)

    Solved! I basically replicated the function of is_home()/is_front_page() with the following, but made it so that the directory location isn’t a factor:

    wp_reset_query(); $thispage = $post->ID; if ( $thispage < 1 )

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    How are you using the two conditionals in your index.php?

    Thread Starter lukemj

    (@lukemj)

    I tried several combinations, none of which worked:

    if (is_home()) :

    if (is_front_page()) :

    if (is_front_page() && is_home()) :

    if (is_front_page() || is_home()) :

    The last one worked well when I used it in my test environment. I’m not familiar enough with those functions to know how they operate, but my guess was that they were factoring in the subdirectory somehow. I honestly don’t know if that’s the case, but the above string I posted works because it operates solely based on whether the page’s number is less than one (returns ‘true’ for the index and ‘false’ for any other page).

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Have you read how is_home and is_front_page work?

    Part of it may be what you have your ‘reading’ setting at. That’s one thing I can think of.

    Thread Starter lukemj

    (@lukemj)

    Yes. I read all the documentation on them, however, I have no idea how or where to set the “reading.” The “WordPress address” and “site address” are both set to the subdirectory. Someone else set everything up and he will be taking over webmaster duties once I install the theme, so I don’t want to tamper with the settings too much.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘is_home(), is_front_page() not working’ is closed to new replies.