Forums

Display Active Viewed Category (2 posts)

  1. adapting
    Member
    Posted 5 years ago #

    The theme K2 can display a list of pages and separate the active viewed page from the rest. Check out what I mean at http://getk2.com/

    This is done by using the following code:

    <ul class="menu">
    			<?php if ('page' != get_option('show_on_front')) { ?>
    			<li class="<?php if ( is_home() or is_archive() or is_single() or is_paged() or is_search() or (function_exists('is_tag') and is_tag()) ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_settings('home'); ?>/" title="<?php echo get_option('k2blogornoblog'); ?>"><?php echo get_option('k2blogornoblog'); ?></a></li>
    			<?php } ?>
    			<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
    			<?php wp_register('<li class="admintab">','</li>'); ?>
    		</ul>

    It seems the key line is <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>

    Instead of listing pages. I want to list categories. I have check out wp_list_cats() which says the php should be wp_list_categories but I cannot get it working.

    By working I mean to display a simple list like on K2 but instead of pages being displayed, categories will be displayed and the active category will be separated from the rest ...

    How do I do this?

    Thanks

    Alan

  2. Andrew Ozz
    WordPress Dev
    Posted 5 years ago #

    If you are running WP 2.1, check http://codex.wordpress.org/Template_Tags/wp_list_categories for the right arguments.

Topic Closed

This topic has been closed to new replies.

About this Topic