Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the Taxonomy Images plugin and am trying to sort the taxonomy but Taxonomy Images isn't playing nice. This works:

$terms = get_terms( 'work_cat', $args );

but this doesn't:

$terms = apply_filters( 'taxonomy-images-get-terms', '', $args );

Any ideas? Here's the full query:

<?php
    $args = array(
        'taxonomy'     => 'work_cat',
        'orderby'      => 'id',
        'order'        => 'ASC',
        'hierarchical' => 1,
    );

    $terms = apply_filters( 'taxonomy-images-get-terms', '', $args );

    $i = 0;
    $len = count($categories);
    foreach ($terms as $term) {
    ?>
        <div class="fourcol <?php if ($i == 0): ?> first<?php elseif ($i == $len - 1): ?> last<?php endif; ?>">
        <a href="<?php echo get_term_link($term->slug, 'work_cat'); ?>"><?php echo wp_get_attachment_image( $term->image_id, 'full' ); ?></a>
        <h2><?php echo $term->name; ?></h2>
        <p><?php echo $term->description; ?></p>
        <a href="<?php echo get_term_link($term->slug, 'work_cat'); ?>">See More &raquo;</a></div>

    <?php $i++;
    }
?>

Original post: http://wordpress.org/support/topic/plugin-taxonomy-images-doesnt-adhere-to-orderby-argument

share|improve this question
    
1st: What is apply_filters( 'taxonomy-images-get-terms', '', $args ) supposed to do? 2nd: Please don't cross post. Solve the question in one OR another place. Thanks. –  kaiser Sep 3 '12 at 22:27

1 Answer 1

up vote 1 down vote accepted

Try this: within $args, leave 'taxonomy' where it is and put the remaining three arguments in a 'term_args' sub-array.

Based on the documentation, it appears that the filter passes arguments to get_terms() through a 'term_args' sub-array. Your $args array is mixing filter arguments and get_terms() arguments at the same level, and it looks like that isn't supposed to work.

I have not tested this, but it's worth a shot.

http://wordpress.org/extend/plugins/taxonomy-images/

G'luck!

E.

share|improve this answer
    
That did the trick—and thanks for pointing out the term_args in their documentation—I missed that (didn't know to look for it)! Cheers Erik. –  robalan Sep 4 '12 at 15:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.