Hide a widget on the home page (6 posts)

  1. Mat_
    Posted 8 years ago #


    I would like to hide a widget juste on the home-page (and maybe use this tip on another page).

    It's a simple code on the widget:

    <li><h3>Ev&egrave;nements &agrave; venir</h3>
     <?php ec3_get_events() ?>

    I already tried with a

    if(!is_home()){my code ...}
    if(!(is_home())){my code ...}

    but it isn't working.

    I already saw this thread: http://wordpress.org/support/topic/133642?replies=3
    but it's a modification in the widget.php and i would like a modification just in the sidebar.php

    I already tried this:

    <?php if(is_home())
      echo '<li><h3>Ev&egrave;nements &agrave; venir</h3>';
      echo '</li>';

    too but it's not working ...

    Any tips ?
    Thanks a lot !

  2. moshu
    Posted 8 years ago #

    Are you putting that in a text widget?
    PHP will not work in text widgets. See if this plugin helps:

  3. Mat_
    Posted 8 years ago #

    No, it's not in a text plugin, it's hardcoded in my sidebar.php ... That's why i'm looking for the php code to hide this part of my sidebar.

  4. moshu
    Posted 8 years ago #

    If you use widgets... it doesn't matter what you code in the sidebar. Widgets override any manual code!

  5. Mat_
    Posted 8 years ago #

    Ok sorry, i didn't explain myself correctly.
    I'm using some code in the sidebar and not widget. I was calling widget the different section in the sidebar.
    So in my code ? can i hide something on the homepage ?

  6. moshu
    Posted 8 years ago #

    OK. The right syntax is in the Codex: Conditional_Tags

Topic Closed

This topic has been closed to new replies.

About this Topic