WordPress.org

Ready to get started?Download WordPress

Forums

My Category Order
how to use wp_list_categories('orderby=order&title_li=');? (4 posts)

  1. matteoraggi
    Blocked
    Posted 3 years ago #

    Ok, it do't work with subcategories, so i have splitted all my categories by han on cde of sidebar without use widget:
    but how to insert this code on sidebar template?
    1) If I insert directly
    wp_list_categories('orderby=order&title_li=');
    then I rad it on top of siebar.
    2) If I insert it in this way:
    <?php value: wp_list_categories('orderby=order&title_li=');?>
    then all disappear apart head and I read this error:
    Parse error: syntax error, unexpected ':' in /home/partyfunit/domains/partyefun.it/public_html/scherzi/wp-content/themes/smells-like-facebook/sidebar.php on line 2
    ---------
    Here is code of my categories, that I have listed here by number, but then they are showed alfabetically and i don't want it:
    <?php wp_list_categories('include=7,39,45,46,8,9,10&title_li=<h2>' . __('Fun') . '</h2>' ); ?>

      ('orderby=order&title_li=');
      <?php wp_list_categories('include=11,48,13,49,74,51,52,17,50,38,3&title_li=<h2>' . __('Party') . '</h2>' ); ?>

      <?php wp_list_categories('include=14,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72&title_li=<h2>' . __('Eventi') . '</h2>' ); ?>

    on the site http://www.partyefun.it/scherzi/

  2. matteoraggi
    Blocked
    Posted 3 years ago #

    I want to who categoris in ths order for PARTY: (just this)
    11 Celibato
    48 Nubilato
    13 Compleanni
    49 Diploma
    74 Laurea
    51 Festa della Donna
    52 Notte Rosa
    17 Halloween
    50 Natale
    38 Ravviva la festa aziendale
    3 Cucina

  3. David Sader
    Member
    Posted 3 years ago #

    http://codex.wordpress.org/Template_Tags/wp_list_categories

    By default, your only choices for orderby are:
    ID
    name - Default
    slug
    count
    term_group

    If you are WP multisite with global_terms_enabled you won't be able to edit the slug.
    If you are a single install of WP3 edit the slug.(ie instead of slug = catname, change it to slug = 1_catname, 2_catname etc)

    <?php
    $args = array(
      'include'     => '11,48,13,49,74,51,52,17,50,38,3',
      'orderby'      => 'slug',
      'order'      => 'ASC',
      'title_li'     => '<h2>'.__( 'Party' ).'</h2>',
    );
    wp_list_categories($args);
    ?>

    If you install the "My Category Order" plugin correctly:

    http://wordpress.org/extend/plugins/my-category-order/installation/

    It adds a new parameter 'order' to 'orderby' and an admin page to edit category order. (The plugin does not check for global_terms_enabled, so you might not want to run this plugin in WP3 multisite, I figure.)

    Anyway, after setting up your new category order, your sidebar code might become something like what you've posted above:

    <?php
    $args = array(
      'include'     => '11,48,13,49,74,51,52,17,50,38,3',
      'orderby'      => 'order',
      'title_li'     => '<h2>'.__( 'Party' ).'</h2>',
    );
    wp_list_categories($args);
    ?>
  4. Wuk
    Member
    Posted 3 years ago #

    You can always change the line responsible for outprinting categories: wp_list_categories($bm_query);
    (look for it in your theme functions)
    to that (so you can change categories order, just change names and numbers)
    Code

    It is much faster than WP default function and does exactly the same.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic