WordPress.org

Ready to get started?Download WordPress

Forums

Hide a widget on the home page (6 posts)

  1. Mat_
    Member
    Posted 6 years ago #

    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 !

  2. moshu
    Member
    Posted 6 years ago #

    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/

  3. Mat_
    Member
    Posted 6 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
    Member
    Posted 6 years ago #

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

  5. Mat_
    Member
    Posted 6 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
    Member
    Posted 6 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