WordPress.org

Ready to get started?Download WordPress

Forums

Media Categories
[resolved] limit categories (7 posts)

  1. deepbevel
    Member
    Posted 1 year ago #

    I use a plugin which limits categories by user role, but all categories are accessible as media categories..

    Is there a way to limit categories with this plugin?

    I've read a bit about using another taxonomy, I suppose that way I could have limitation. I understand the idea but not the application.
    Is the coding done in the plugin template files? or in wp? any examples on how to do this?

    this is what I'm refering to, where can I find this code?

    add_filter('mc_taxonomy', 'mc_filter_taxonomy');
    
    function mc_filter_taxonomy($taxonomy){
    
        if($taxonomy == 'category'){
            $taxonomy = 'post_tag';
        }
    
        return $taxonomy
    }
  2. deepbevel
    Member
    Posted 1 year ago #

    okay, I figured it had to be a functions code,
    I managed to change the taxonomy to tags, if anyone else had trouble with the mc_taxonomy filter, it goes in in functions.php,
    BUT there is a syntax error in the code given under help notes:

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

    the return should be:

    return $taxonomy;

    it was missing the ";"

    two days wondering why I couldnt impliment this...

  3. deepbevel
    Member
    Posted 1 year ago #

    Even though the available tags appear in the attchment editor,like with categories, when I select one and save, the selection is not saved and the tag does not appear in the tag cloud or under the image attachment....?

  4. deepbevel
    Member
    Posted 1 year ago #

    Okay, I added the

    $my_custom_media_metabox = new Media_Categories('post_tag');

    in front of the mc_taxonomy filter in functions.php.
    It works! it saves the tag and the tags appears in the wp tag cloud..

    but now I have 2 tag metaboxes in the attachment editor!
    And, still no output on the tag page when I click the tag in the cloud..

    How can I have just one metabox that will save a tag taxonomy?

    How can I display the tagged images via a list, or tag cloud, or tag links below the post, or any other way beyond the shortcode?

  5. deepbevel
    Member
    Posted 1 year ago #

    I tried adding my attachment code for my theme as output in my tag template, it no longer gets a 404 but the tag page is empty.

    This plugin is really something, I've been trying to get somethng like this for at least a year. My understanding of code is limited to basics, this is the first time I've had ANY progress in this area.

    I'll gladly forgo the functioning tag links if need be, and just hardcode links to the pages which output the shortcode. It will show some empty tags, but not for long.
    the tag links below the attachment are not particularly useful for my purpose anyway. Users will reference the tag first, so they'll know how the image is tagged.

    hopefully I'll figure a way to remove that extra metabox, maybe with css..

  6. deepbevel
    Member
    Posted 1 year ago #

    used css, it worked! although I doubt I did this "properly" and I am possibly missing out on a way to have a tag page which reurns these image tags, I have exactly what I was looking for, very grateful for this plugin!

    .category_metabox
    {
    display:none;
    }
  7. deepbevel
    Member
    Posted 1 year ago #

    I've been able to get the media categories to output in a category or tag template, using get_shortcode for what ever media category or tag exists. Not bad.

    The issues I face are not having enough control over this output. Seems wp has no way to page or limit the display of gallery images. I expect I'll have 100's of images in each category, from multiple gallery posts, but no way to order, or even include any content with the imgages (link back to post, meta, title, author, ect.)

    I realize I get all that on attachment pages, but I want users to be able to page within the media categories. That means "link to file" in a lightbox. So no attachment page option. And so no image info beyond a title and caption. Poo.

    And, my favorite plugin "Cleaner Gallery" can't work it's magic of auto adding caption links to attachment pages. I guess it doesn't recognize the modded gallery shortcode.

    I'm wondering If I can somehow add an additional metabox under gallery thumbs for such a purpose? and will it show up?

    if anyone else is using this plugin to output image taxonomies from mutiple galleries to a page and has come up with a good method please share.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.