• Hello,

    I tried to search almost all options but unable to do it.

    I want to display a widget in the sidebar of my WordPress site which will be visible only on the home page and not child pages/subpages like domain.com/page/2/ or 3 and so on.

    using code: is_home() or front page code it is showing on the home page as well as those subpages.

    Please help me with it.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Hi,

    You can solve this using following condition:
    is_home() && !is_paged()

    Since you haven’t set any homepage in Dashboard > Settings > Reading, you’ll need is_home() [and not is_front_page()].
    Also for NOT showing the widget on the sub-pages, you’ll need !is_paged() in combination with is_home().

    Both of these are required to be true to fulfil your requirement and hence you need && condition.

Viewing 1 replies (of 1 total)
  • The topic ‘Showing a Widget Only on Home page not child pages’ is closed to new replies.