WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Don't want to order Category alphabetically (4 posts)

  1. Trudie K
    Member
    Posted 2 years ago #

    I have a template that sets the categories in alphabetical order. I would like to change this to an different order, but unfortunately do not know how. Can anyone help me? This is the code.

    <?php foreach(get_categories('parent=0&taxonomy=dealers') as $category) { ?>
    	<div class="row">
    		<h2 class="divider"><?php echo $category->name; ?></h2>
    		<?php
    			$args = array('orderby' => 'slug', 'order' => 'ASC', 'tax_query' => array(array('taxonomy' => 'dealers', 'field' => 'id', 'terms' =>  $category->cat_ID)));
    			$loop = new WP_Query($args);
    		?>
  2. Phil
    Member
    Posted 2 years ago #

    The clue is in the code:

    'order' => 'ASC'

    asc = ascending.

    You can view here the possible ways to order posts.

  3. Trudie K
    Member
    Posted 2 years ago #

    Sorry, but unfortunately that is not what I am looking for.

  4. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    What are you looking for? The codex page at the link PSM Digital provided, shows what values you can use for the 'orderby' and 'order' values.

    If you want to specify a fixed order, perhaps the Category Order and Taxonomy Terms Order plugin will help?

Topic Closed

This topic has been closed to new replies.

About this Topic