MLA taxonomy and custom taxonomy archive pages
-
First of all thanks for the great plugin, a well-thought piece of software.
I installed MLA and added another small plugin I wrote to add another taxonomy to attachments, so that I ended up with:
– attachment_category
– attachment_tag
– autore (italian for author) with this setup$labels = array( 'name' => 'Autori', 'singular_name' => 'Autore', 'search_items' => 'Cerca autori', 'all_items' => 'Tutti gli autori', 'edit_item' => 'Modifica autore', 'update_item' => 'Aggiorna autore', 'add_new_item' => 'Aggiungi nuovo autore', 'new_item_name' => 'Nuovo autore', 'menu_name' => 'Autore', 'popular_items'=> 'Autori apprezzati', 'parent_item' => null, 'parent_item_colon' => null); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'update_count_callback' => '_update_generic_term_count'); register_taxonomy('autore', 'attachment', $args);
Then created two tag clouds widgets with the appropriate taxonomy, that were populated with links in the form
mysite.com/blog/attachment_tag/tagname
mysite.com/blog/autore/authornameClicking on them got nothing (404 page) until I hooked the query with
global $wp_query; if (is_tax('autore') OR is_tax('attachment_category') OR is_tax('attachment_tag')) { $wp_query->query_vars['post_type'] = array( 'attachment' ); $wp_query->query_vars['post_status'] = array( null ); return $wp_query; } }
after this I got archive.php displaying nicely my taxonomy, but NOT MLA-generated taxonomies, e.g. I still get archive.php, but it’s empty.
Questions (be patient, i’m new to this taxonomy stuff):
1) any idea of why this strange behaviour?
2) is this the “right way to do it” e.g. hooking the query and using archive.php (or maybe taxonomy-<taxonomy>.php?) or I could have a shortcode-powered page as a landing page for taxonomy links from the tag clouds or elsewhere?
3) Some suggestions on how to implement a search function that searchs only attachments based on the three taxonomies terms (maybe also attachment name?) and displays them in a search result page?
4) as a general rule, I do NOT want images to be included in results. One obvious strategy is to not attach taxonomy terms to any image I don’t want included. Nothing more refined?Thanks you for your attention. Really, thanks. The site I’m running is also a nonprofit, and I know the value of your time.
https://www.ads-software.com/plugins/media-library-assistant/
- The topic ‘MLA taxonomy and custom taxonomy archive pages’ is closed to new replies.