-
AuthorPosts
-
March 5, 2018 at 1:50 pm #921474
Dear sirs,
I need to enable a category filter in portfolio dashboard, for portfolio elements, as it happens for the post dashboard. Is it possible to add a script to the child function file that does this?
Thanks so muchMarch 6, 2018 at 6:01 am #922050Hey Alternalab,
Thank you for using Enfold.
Please use the “restrict_manage_posts” hook to add the category or taxonomy filters.
function restrict_manage_posts_portfolio( $post_type, $which ) { // Apply this only on a specific post type if ( 'portfolio' !== $post_type ) return; // A list of taxonomy slugs to filter by $taxonomies = array( 'portfolio_entries' ); foreach ( $taxonomies as $taxonomy_slug ) { // Retrieve taxonomy data $taxonomy_obj = get_taxonomy( $taxonomy_slug ); $taxonomy_name = $taxonomy_obj->labels->name; // Retrieve taxonomy terms $terms = get_terms( $taxonomy_slug ); // Display filter HTML echo "<select name='{$taxonomy_slug}' id='{$taxonomy_slug}' class='postform'>"; echo '<option value="">' . sprintf( esc_html__( 'Show All %s', 'avia_framework' ), $taxonomy_name ) . '</option>'; foreach ( $terms as $term ) { printf( '<option value="%1$s" %2$s>%3$s (%4$s)</option>', $term->slug, ( ( isset( $_GET[$taxonomy_slug] ) && ( $_GET[$taxonomy_slug] == $term->slug ) ) ? ' selected="selected"' : '' ), $term->name, $term->count ); } echo '</select>'; } } add_action( 'restrict_manage_posts', 'restrict_manage_posts_portfolio' , 10, 2);
// https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/
Best regards,
IsmaelMarch 7, 2018 at 12:05 pm #922884It works!!!
Thank you very much Ismael!March 7, 2018 at 1:21 pm #922964Hi Alternalab,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
VictoriaMarch 13, 2018 at 12:37 pm #926048Hi guys!
I’ve got another small issue about that. I’m using a plugin called “Post Types Order”, which allows to reorder portfolio elements by a simple drag and drop. Once I filter the category, this feature is not active anymore and I’m not able to reorder the portfolio elements. Is there a way to leave the reordering feature active also after the filtering?
Thank youMarch 15, 2018 at 6:50 am #927080Hi,
I’m sorry but we don’t provide support for third party plugins as stated on our support policy. Please contact the plugin author for more info.
Best regards,
IsmaelDecember 3, 2018 at 12:54 pm #1040253Hello Alternalab,
I have exactly the same problem. I use the “Post Types Order” plugin and i need it to work when i filter the category for portfolio items.
Did you find a solution for that?Any help will be much appreciated.
Thank you
December 4, 2018 at 5:12 pm #1040796Hi Dmanbo,
I am afraid you’ll need to contact the plugin author for more info about the issue. Making third-party plugins compatible with the theme is unfortunately beyond the support scope we offer. Sorry for that!
Best regards,
VictoriaDecember 5, 2018 at 10:09 am #1041130The support team of “Post Types Order” plugin informed me that the paid version allow re-order inside categories. So that the answer. :-)
I wrote it here to possibly help anyone having the same issue.Thank you
- This reply was modified 6 years ago by Dmanbo.
-
AuthorPosts
- You must be logged in to reply to this topic.