Forums

Help with 'wp_list_categories' function (2 posts)

  1. lorenzawodny
    Member
    Posted 3 years ago #

    Hello,

    I am trying to modify my existing categories.php layout to include a row of 5 tabs that will list the 'child_of' sub-categories for the current category.

    I have had some success with the following code:

    <div id="tabs">
    
    <?php if (have_posts()) : ?>
    
    <ul>
    <?php wp_list_categories('depth=1&title_li=0&sort_column=menu_order&title_li=&child_of=///Category ID///&number=5'); ?>
    </ul>
    
    <?php endif; ?>
    
    </div>

    Note: I used a fixed category ID where indicated.

    What I need is a script that will fetch the current category ID or Slug, so I can use it in place of the fixed number.

    For your reference, the example page is at: http://lzguitar.net/blog/categories/resources

    I am a bit of a novice here, so any help and explanation will be of great assistance.

    Regards,

    Loren Z

  2. t31os
    Member
    Posted 3 years ago #

    See examples here for getting cat ID.
    http://wordpress.org/support/topic/220210?replies=6

Topic Closed

This topic has been closed to new replies.

About this Topic