Forums

another way to detect homepage? (2 posts)

  1. fitzpatrick512
    Member
    Posted 1 year ago #

    I'm trying to use a conditional to detect the homepage and display homepage specific content.

    I'm using a theme that uses URLs like:

    https://www.site.com/wordpress/?ptype=checkout

    to display e-commerce related content, so I'm running into an issue where my conditional tags to detect home pick up all the checkout etc. pages as the homepage as well.

    So I'm looking into another way to do it, one that doesn't depend on wordpress variables, but instead on the URL.

    How would I implement something like this?

    if ( $_SERVER["REQUEST_URI"] == '/' )
    {
    /* do something */
    }

  2. MichaelH
    Volunteer
    Posted 1 year ago #

    Did you consider one of the Conditional Tags such as is_home()?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.