• I have a custom page that I’m trying to add to the site. I have it all working fine except that the site treats the custom page as home. IE it is showing the items that are supposed to only show on the home.

    So how can I tell WP that this is_not_home?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • !is_home()

    ! = not in PHP lingo.

    Thread Starter morbius

    (@morbius)

    Okay, pretend I’m even more dumb then that. ^^

    To be more specific I have a custom page in the WP root that is calling all the template files like get_header() etc. It works fine.

    I’m just looking for a code snippet that tells WP that this is not the index.

    So how would !is_home() be implemented if that is the solution?

    I try not to pretend about dumbness…

    If by “custom page” you mean a separate PHP doc outside the normal WordPress setup (i.e. it includes wp-blog-header.php to enable the WP functionality), you can try resetting the $wp_query to return a false value for is_home. You do that like so:

    <?php $wp_query->is_home = false; ?>

    If you get an error about $wp_query (or it just doesn’t work), try:

    <?php
    global $wp_query;
    $wp_query->is_home = false;
    ?>

    I would put this before any of the get_header() etc, but after the wp-blog-header.php include.

    Thread Starter morbius

    (@morbius)

    Ah! It worked! I thank you so very much! ^^

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_not_home’ is closed to new replies.