WordPress.org

Ready to get started?Download WordPress

Forums

is_home() or is_front_page() to check home.php (1 post)

  1. Luke McDonald
    Member
    Posted 3 years ago #

    I recently wanted to enqueue a script to be used specificically on the home page. Using the template home.php, is_home() or is_front_page() does not seem to detect if home.php is in use. I also tried is_page_template( 'home.php' ) for the heck of.

    The solution ended up being if( home_url() ) { ... }. It seems like is_home() or is_front_page() should detect if home.php is in use, which is essentially the home page, hence is_home().

    Thought I would bring this up and see if I'm missing something or if this should be included in one of the various "home" checks.

Topic Closed

This topic has been closed to new replies.

About this Topic