Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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 much

    #922050

    Hey 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,
    Ismael

    #922884

    It works!!!
    Thank you very much Ismael!

    #922964

    Hi Alternalab,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #926048

    Hi 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 you

    #927080

    Hi,

    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,
    Ismael

    #1040253

    Hello 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

    #1040796

    Hi 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,
    Victoria

    #1041130

    The 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 5 years, 11 months ago by Dmanbo.
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.