WordPress.org

Support

Support » How-To and Troubleshooting » Hide a widget on the home page

Hide a widget on the home page

  • Hi!

    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() ?>
     </li>

    I already tried with a

    if(!is_home()){my code ...}
    or
    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())
      return;
      echo '<li><h3>Ev&egrave;nements &agrave; venir</h3>';
      ec3_get_events(7);
      echo '</li>';
    ?>

    too but it’s not working …

    Any tips ?
    Thanks a lot !

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you putting that in a text widget?
    PHP will not work in text widgets. See if this plugin helps:
    http://ottodestruct.com/blog/2006/04/09/fun-with-widgets/

    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.

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

    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 ?

    OK. The right syntax is in the Codex: Conditional_Tags

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide a widget on the home page’ is closed to new replies.
Skip to toolbar