Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1094744

    Sorry if this has been covered, but I couldn’t find anything with a search…

    Is there a straightforward way to add an ability to filter Portfolio items by Category in the WordPress admin console? (Not talking about filtering in an element or widget, but rather in the admin view.) For my purposes this would be a very useful feature. Any thoughts are welcome.

    Thank you.



    Hey Gary,

    Thank you for using Enfold.

    A quick search led me to this snippet.

    function pippin_add_taxonomy_filters() {
    	global $typenow;
    	// an array of all the taxonomyies you want to display. Use the taxonomy name or slug
    	$taxonomies = array('portfolio_entries');
    	// must set this to the post type you want the filter(s) displayed on
    	if( $typenow == 'portfolio' ){
    		foreach ($taxonomies as $tax_slug) {
    			$tax_obj = get_taxonomy($tax_slug);
    			$tax_name = $tax_obj->labels->name;
    			$terms = get_terms($tax_slug);
    			if(count($terms) > 0) {
    				echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
    				echo "
    <option value=''>Show All $tax_name</option>";
    				foreach ($terms as $term) { 
    					echo '
    <option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>'; 
    				echo "
    add_action( 'restrict_manage_posts', 'pippin_add_taxonomy_filters' );

    This is going to add a category filter in the portfolio admin area.


    Best regards,


    Thank you so much. I will give this a try!

    Edit: and it works a treat!


    • This reply was modified 1 year, 4 months ago by  garyvot.


    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Filter Portfolio Items by Category in Admin Console’ is closed to new replies.