Viewing 6 replies - 1 through 6 (of 6 total)
  • Use the get_categories function (see here for more info):

    $categories = get_categories('order_by=name');

    Thread Starter toplinepub

    (@toplinepub)

    Cool – thanks – I’m not an expert, so if you don’t mind me asking, where do I put that code, in the Sidebar.php section? Thanks again!

    You’ve got to place that code (plus more code for printing the categories) in the functions.php file of your theme. Basically, create a widget, then place that widget on your sidebar via WordPress.

    Thread Starter toplinepub

    (@toplinepub)

    OK – cool – I hate to bother, but if you could indulge me on this one….I am working with an already existing theme with this code for showing the categories on the side:

    <?php include (TEMPLATEPATH . '/options/options.php'); ?><div id="sidebar"><?php include (TEMPLATEPATH . '/domtab.php'); ?> <?php if (function_exists('fc_feedcount')): ?><div id="rss-feeds"><div id="rss-block"><a href="#">&nbsp;</a></div><div id="rs-count"><?php fc_feedcount(); ?></div></div><?php endif; ?><?php include (TEMPLATEPATH . '/advertisment.php'); ?><?php if($tn_mz_aside_post_status==yes): ?><div id="more-headline"><?php $my_query = new WP_Query('category_name='. $tn_mz_aside_post_cat . '&' . 'showposts='. $tn_mz_aside_post_sum);while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; ?><div class="side-feat"><?php $values = get_post_custom_values("featured-images");if ( is_array($values)) : ?><div class="span-img"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo "$values[0]"; ?>" alt="<?php the_title(); ?>" /></a></div><?php endif; ?><h1><?php the_title(); ?></h1><?php the_excerpt_aside(); ?></div><?php endwhile;?></div><?php endif; ?><?php if($tn_mz_side_thumbnail_status==yes): ?><div id="my-wp-theme"><div id="theme-slot"><ul><?php $my_query = new WP_Query('category_name='. $tn_mz_side_thumbnail_cat . '&' . 'showposts='. $tn_mz_side_thumbnail_sum);while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; ?><?php $values = get_post_custom_values("themes-images");if ( is_array($values)) : ?><li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo "$values[0]"; ?>" alt="<?php the_title(); ?>" /></a></li><?php else : ?><li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/no-image.gif" alt="<?php the_title(); ?>" /></a></li><?php endif; ?><?php endwhile;?></ul></div></div><?php endif; ?><div id="widget-sidebar"><!--[if !IE]>SIDEBAR WIDGET<![endif]--><div class="bar"><?php if ( !function_exists('dynamic_sidebar')|| !dynamic_sidebar(1) ) : ?><?php if(function_exists("wp_theme_switcher")) : ?><h3><?php _e('Themes'); ?></h3><?php wp_theme_switcher('dropdown'); ?><?php endif; ?><h3><?php _e('Categories'); ?></h3><ul class="list"><?php wp_list_categories('orderby=id&show_count=0&use_desc_for_title=0&title_li='); ?></ul><?php endif; ?></div><!--[if !IE]>SIDEBAR WIDGET 2<![endif]--><div class="bar"><?php if ( !function_exists('dynamic_sidebar')|| !dynamic_sidebar(2) ) : ?><!--[if !IE]>sample no list sidebar list<h3><?php _e('Archives'); ?></h3><ul class="nolist"><?php wp_get_archives('type=monthly&limit=12&show_post_count=0'); ?></ul><![endif]--><h3><?php _e('Archives'); ?></h3><ul class="list"><?php wp_get_archives('type=monthly&limit=12&show_post_count=0'); ?></ul><?php endif; ?></div></div></div>

    Can I just place the code you showed me somewhere in there, in the appropriate place?

    THANKS AGAIN!!

    If you mean your sidebar category list, change this bit of code:

    wp_list_categories('orderby=id

    to this:

    wp_list_categories('orderby=name

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

    Hi,

    Refer this article:

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

    Thanks,

    Shane G.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Any way to alphabetize my Categories list on right-hand side?’ is closed to new replies.