Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Boris Kamp
Boris Kamp
16,660 Points

Wordpress archive sorting and element selecting

Hi guys!

Im working on my archive pages and created two nice display options (tile and list view) using javascript Now, in list view, I would like the user to be able to sort the posts by:

1 kitname (retrieved with advanced custom field's 'get_field' php code)

2 scale (retrieved with custom taxonomy:

<?php $terms = get_the_terms( $post->ID , 'scales' ); foreach ( $terms as $term ) { echo $term->name; } ?>

3 manufacturer (retrieved with custom taxonomy:

<?php $terms = get_the_terms( $post->ID , 'manufacturers' ); foreach ( $terms as $term ) { echo $term->name; } ?>

4 country (retrieved with custom taxonomy:

<?php $terms = get_the_terms( $post->ID , 'countries' ); foreach ( $terms as $term ) { echo $term->name; } ?>

5 post date (retrieved with

<?php echo the_time('F j, Y');?>

I will add buttons to the table header (the list view is basically a table) for the users to sort ascending and descending.

Where do I start? I have really no idea and there's not much to find on the internet either...

Thanks!

2 Answers

I actually ran into something similar to this recently. I found a good solution for my situation by using http://jplist.com/. The jQuery plugin (for lack of a better term) has lots of features and lets you sort and search by just about anything you could want.

Boris Kamp
Boris Kamp
16,660 Points

Looks promising! will look into it when I have time. Thanks!

Happy to help! I've used it a few times and it's super simple to implement :)