• Resolved alx359

    (@alx359)


    I’ve modded archive.php for attachment_category and navigate it with [mla_term_list]. It looks great and works as intended so far.

    But there’s a remaining little something that annoys me.

    Links are now of this kind:

    http://mydomain.com/attachment_category/term

    I want them changed to something more meaningful to the project, like this:

    http://mydomain.com/craft-motifs/term

    register_taxonomy has a rewrite field, and this piece for example explains how to fix certain oddities of the process. Anyway, settings > permalinks implies rewriting taxonomy slugs should be possible.

    I’m not sure though how to approach this with MLA. Is it there something hardcoded that may interfere, for example?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for working with me offline to investigate the effects of changing the slug associated with the attachment_category taxonomy. I have uploaded a new MLA Development Version dates 20170910 that contains six new filters (hooks) to control the way MLA registers its two custom taxonomies, Att. Categories and Att. Tags. You can use one of the hooks to implement the change you need for your application by adding something like this to your theme’s functions.php file:

    add_filter( 'mla_attachment_category_arguments', 'mla_attachment_category_arguments', 10, 1 );
    function mla_attachment_category_arguments( $args ) {
    	// Example of a custom "base" value for the taxonomy URLs
    	$args['rewrite'] = array( 'slug' => 'craft-motifs' ); 
    	return $args;
    }
    

    I decided to implement this enhancement with filters rather than change the Settings UI because there are many customizations that would make sense for the taxonomy registrations and the Settings/Media Library Assistant General tab is already quite complicated.

    It would be great if you could install the Development Version and let me know how it works for you. Thanks for motivating this enhancement and for your help in testing it.

    Thread Starter alx359

    (@alx359)

    Seems to be working great. Thanks so much for implementing this improvement! 🙂

    Plugin Author David Lingren

    (@dglingren)

    Thanks for confirming that the suggested solution works for you. I have released MLA version 2.61, which contains the new filters.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding the new version. Thanks for working with me on this enhancement.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘attachment_category rewrite’ is closed to new replies.