WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Custom Tax Not Appearing Hierarchically

[Resolved] Custom Tax Not Appearing Hierarchically

  • Hi,

    I’m using:

    add_filter('mc_taxonomy', 'mc_filter_taxonomy');
    
    function mc_filter_taxonomy($taxonomy){
    
        if($taxonomy == 'category'){
            $taxonomy = 'wcmedia';
        }
    
        return $taxonomy;
    }

    in order to set the taxonomy used by the plugin to be my custom tax.

    But in the media modal, the list of items is not aligned and not hierarchical like it should be. Any ideas why? The “default” installation of the plugin seems to not have these issues.

    View post on imgur.com

    http://wordpress.org/extend/plugins/media-categories-2/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Eddie Moya

    @eddiemoya

    Try using the object oriented methods instead of the filters. I honestly didnt test the filters very thoroughly, I probably should have deprecated them.

    Looks like your trying to use a taxonomy called ‘wcmedia’ instead of the default category taxonomy. So anywhere in your themes functions.php, drop this in.

    $mc_category_metabox->taxonomy = 'wcmedia';

    That should do it. Let me know if this solves your problem.

    Hi,

    Thanks. That tidied it up a bit, though they still aren’t quite hierarchical. I appreciate the help though as it’s definitely more usable now.

    View post on imgur.com

    One thing that seems to be missing is the “add category” though… is that functionality not available yet for custom tax? Great work though, there’s so little documentation out there for the new media manager.

    I really don’t understand why the default wordpress media taxonomies aren’t hierarchical in the modal like they are on the edit media page.

    Plugin Author Eddie Moya

    @eddiemoya

    They should show up hierarchically if the taxonomy is hierarchical. Make sure your taxonomy is hierarchical and that you have some sub-terms in there. Custom taxonomies can be made to be hierarchical or not – and that determines how the taxonomy will show up. Check to make sure that your taxonomy is set up correctly, and if its still incorrect, try it with normal ‘category’ taxonomy – if it doesnt show up correctly still, you probably have a real bug which I’ll be happy to fix. Let me know.

    I have not added the ability to add categories directly from the modal yet – I’ve held off on that in favor of other features like the fact that it collapses – in the future I will hopefully have time to include that functionality.

    With regard to: “I really don’t understand why the default wordpress media taxonomies aren’t hierarchical in the modal like they are on the edit media page.”…

    There is no “default wordpress media taxonomy”, so I am not clear what you mean.

    I meant that if you register an attachment taxonomy (this is what I meant by “default”) it shows up as a tag box, regardless of whether or not you choose hierarchical.

    This is my register taxonomy, which I have specified should be hierarchical.

    register_taxonomy( 'wcmedia', 'attachment',
    array( 'hierarchical' => true,
    'capabilities' => array(
    'manage_terms' => 'install_plugins',
    'edit_terms' => 'install_plugins',
    'delete_terms' => 'install_plugins',
    'assign_terms' => 'publish_posts'
    ),
    'label' => 'Media Categories', 								'has_archive' => true,								'public' => true,
    'query_var' => true,						'rewrite' => true ) );
    Plugin Author Eddie Moya

    @eddiemoya

    In the non-modal media editor – hierarchical taxonomies will show up using a list of checkboxes (like categories), and non-hierarchical taxonomies will show up with a text field where you can enter the terms (like tags). As far as I can tell this works correctly on the non-modal media editor (by non-modal, I mean the normal media editor in the Media Library).

    In the modal, the taxonomy interface is harder to get working, so I made them both simply use the hierarchical interface (like categories) – when a non-hierarchical taxonomy is used, it simply doesn’t show anything indented (which is how child relationships are shown in hierarchical taxonomies in that interface).

    The screenshot you provided above is not a tag box, but if “Will Smith” is actually a child of “Actors” then I see what you mean, hierarchical relation ships are not being displayed properly. If thats the case, please tell me what browser and operating system you are using. I will try to duplicate the problem.

    Plugin Author Eddie Moya

    @eddiemoya

    Were you still having trouble with this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Custom Tax Not Appearing Hierarchically’ is closed to new replies.