WordPress.org

Ready to get started?Download WordPress

Forums

is_category not working in sidebar.php (2 posts)

  1. mamouri
    Member
    Posted 7 years ago #

    Hi,
    I want to use is_category function in sidebar.php. Here is my code:

    <ul>
      <li><a <?php if (is_home()) echo 'id="selected"';?> href="<?php bloginfo('url')?>">Home</a></li>
      <li><a <?php if (is_page('essays')) echo 'id="selected"';?> href="<?php bloginfo('url')?>/essays">Essays</a></li>
          <?php if (is_page('essays') || is_category()):?>
              <ol id="submenu">
                    <?php wp_list_categories('hide_empty=0&child_of=3&title_li=')?>
              </ol>
          <?php endif?>
      <li><a <?php if (is_page('books')) echo 'id="selected"';?> href="<?php bloginfo('url')?>/books">Books</a></li>
    </ul>

    Actually I want show sub menu in the 'essays' page and in the categories. So if user open categories 'A' the submenu being showed.

    Regards

  2. mamouri
    Member
    Posted 7 years ago #

    I could not found anything about this in documentation. But does somebody know that is_category could work in sidebar.php or not?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.