Sure, this should be fairly simple. You can probably hook into list.js (used to sort and filter the list).
If you enable list search (in Sticky List settings) you will se a search bar above the list. What you need then is a dropdown that, when changed, populates the search field. You can also hide the search field if you dont want it.
You will need some basic javascript and CSS to accomplish this.
This was actually very simple.
Just put a select in your page template with all the categories, example:
<select id='my_filter_select'>
<option>First</option>
<option>Second</option>
<option>Third</option>
</select>
Then put this in functions.php
add_action( 'wp_head', 'my_filter_entries' );
function my_filter_entries() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#my_filter_select').change(function(event) {
userList.search($(this).val());
});
});
</script>
<?php }
Marvellous – thanks. Looks like a good solution. HTML fine but but when I tried code in functions.php it crashed my site! Dead, late, no more.
Writing for the techs to revive it … fingers crossed, heart bearing anxiously.
From your point of view is the PHP OK? I don’t know enough to say one way or the other. I am slightly puzzled by the 3rd line and the very last line, but what do I know!
Thats very strange. The code above should not break anything. Try this instead. In your page template, insert:
<select id='my_filter_select'>
<option>First</option>
<option>Second</option>
<option>Third</option>
</select>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#my_filter_select').change(function(event) {
userList.search($(this).val());
});
});
</script>
fried_eggz that’s marvellous. Works a treat and seems to do just what I need. Thank you.
No problem, glad I could help. If you need the select drop-down to be automatically populated with the categories, that can be done too.
Anyways, if you like the plugin and the support, please consider writing a short review. Thanks!
“…to be automatically populated with the categories…”
Yes please. That would be useful and interesting o know how to do that.
And yes, will write a review.
OK, if we are talking about standar WordPress categories, you can try this code instead of the code posted above.
<select id='my_filter_select'>
<?php $categories = get_categories();
foreach ($categories as $category) { ?>
<option><?php echo $category->cat_name; ?></option>
<?php } ?>
</select>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#my_filter_select').change(function(event) {
userList.search($(this).val());
});
});
</script>
Thanks fried_eggz
Great support as usual – I can’t try this just now as the site is having some back-end maintenance but will do in the next few days.