WordPress.org

Support

Support » Plugins and Hacks » Taxonomy Images » [Resolved] [Plugin: Taxonomy Images BETA] How to change order of taxonomies on the page?

[Resolved] [Plugin: Taxonomy Images BETA] How to change order of taxonomies on the page?

  • Is it possible to order the taxonomies, by their ID or perhaps even more usefully by Description?

    $cats = get_categories('taxonomy=my_taxonomy_category');
    foreach ( $cats as $c ) {
    $url = get_category_link( $c->term_id );
    echo '<h2>name . '" >'.$c->name.'</h2>';
        $img = $taxonomy_images_plugin->get_image_html( 'thumbnail', $c->term_taxonomy_id );
        if( !empty( $img ) )
            print '' . $img . '';
    }
Viewing 1 replies (of 1 total)
  • After thinking about it, I realised this is nothing to do with this plugin. I found a way to sort the category array by its description field, so I can now give that field a number to define its category order.

    function sortStdArray($cats,$index){
     $sort=array();
     $return=array();
     for ($i=0; isset($cats[$i]); $i++)
     $sort[$i]= $cats[$i]->{$index};
     natcasesort($sort);
     foreach($sort as $k=>$v)
     $return[]=$cats[$k];
     return $return;
     }
     $cats = sortStdArray($cats,"description");
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [Plugin: Taxonomy Images BETA] How to change order of taxonomies on the page?’ is closed to new replies.
Skip to toolbar