Att Categories menu returns 404 error
-
Hi,
When using https://www.mydomain.nl/attachment_category/flowers/, i get a 404 error. This seems to be an issue with the permalinks setting.
When setting permalinks to standard and try https://www.mydomein.nl/?attachment_category=flowers, it doesn’t return a 404 but still an empty page.
What is needed to display the media at the front end of the website and/or how does this work based on att category or att tags?
The idea is that i create a menu from all of the available Att Categories, displat the menu in a widget (right sidbar), so visitors can ‘filter’ on Att Category and view media within that particular Att Category.
Thanks in advance!
Marcellino
https://www.ads-software.com/plugins/media-library-assistant/
-
Thanks for your question and for the time you took to explain the details of your application.
The 404 errors and the blank pages happen because the WordPress “archive pages” are designed to display posts and pages, not attachments/media items. You can find more information and examples of alternative solutions in these earlier support topics:
Using tag cloud shortcode to display galleries
How to display pad_counts for hierarchical taxonomies
The simplest solution is to compose a WordPress Page with the
[mla_gallery]
that displays the items assigned to a given term, then create an[mla_tag_cloud]
the links to this page passing the term you picked from the cloud. You can use the MLA Text Widget to put the cloud in a widget if you like. The first topic above describes that approach.You can also change the WordPress template for your archive pages, but this is more complex and requires PHP coding. If you want to pursue that, let me know and I can give you some guidance on how to do it.
I will leave this topic unresolved until I hear back from you, so I can answer any more specific questions you have on how to complete your application. Thanks for your interest in the plugin.
David,
I would appreciate the guidance on archive page changes, so attachment media items can be shown.
Also not sure how to do the mla_gallery in combination with the mla_tag_cloud. I assume it passes in a variable so only one page needs to be created with the mla_gallery shortcode. Could you provide a code sample for this?
Would be great if there was a website where all ‘proven/working’ shortcodes methods and samples are available and users can share their code (or is there a website like this that you maintain).
Really love this extension and your great and extensive feedback that you give everytime on all support requests. Chapeau!
Thanks in advance!
Marcellino
Thank you for your kind words on the plugin and its support. These support topics are the closest thing I have to a repository of shortcodes, methods and samples. I wish it were easier to find relevant topics more easily. When I get a new support question I try to post links to earlier answers and examples.
There are also some resources in the
/plugins/media-library-assistant/examples
directory and the/twentytwelve-mla
child theme there. Again, I wish it were easier to find a specific solution there.You ask “how to do the mla_gallery in combination with the mla_tag_cloud“. Here is an updated version of an example I gave in the earlier “Using tag cloud shortcode to display galleries” topic:
<h3>The Cloud</h3> Click on a term to populate the gallery below. [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}?term_slug={+slug+}"] <h3>The Gallery</h3> [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="Nothing to show."]
The
[mla_tag_cloud]
displays Att. Categories terms in the familiar cloud format. Thenumber=0
parameter ensures that all of the terms are displayed. Themla_link_href
parameter links each term back to the current page ({+page_url}
) and passes a variable back with the term selection (?term_slug={+slug+}
). If you put the[mla_tag_cloud]
shortcode on another page or in a widget you will have to hard-code the URL portion of the link.The
[mla_gallery]
displays the images assigned to the selectedattachment_category
term. Themla_nolink_text
parameter gives the text to display when the gallery is empty, e.g., before you click on a term. In this shortcode:- The template: prefix says that this is a Content Template
- The parentheses “()” around the two elements are used to group them into a list of alternatives
- The vertical bar “|” between the two elements means “stop when you get a non-empty alternative”
- {+request:term_slug+} will be empty unless there is a term_slug in the URL
- a-bad-term is a literal value (and thus never empty) which does not match any term in the attachment_category taxonomy, so the gallery will be empty if this alternative is used
You can read more about templates in the “Content Templates” section of the Settings/Media Library Assistant Documentation tab. There are lots of other shortcode parameters you can use to customize this example, too.
Regarding your request for “guidance on archive page changes“, you can find more information in these topics:
MLA taxonomy and custom taxonomy archive pages
The Pagination Revisited topic has several posts, but the post towards the end is specific to the archive page topic.
I collected the wisdom from these topics and created a
taxonomy.php
template in my/twentytwelve-mla
child theme (in the/examples
directory. Templates are theme-specific, so my examples must be adapted to your site’s theme. My exampletaxonomy.php
file contains:<?php /** * The template for displaying Custom Taxonomy Archive pages * * Twenty Twelve already has tag.php for Tag archives and category.php for Category archives. * * @link https://codex.www.ads-software.com/Template_Hierarchy * * @package Media Library Assistant * @subpackage MLA_Child_Theme * @version 1.00 * @since MLA 1.80 */ get_header(); ?> <?php global $wp_query; $is_media_archive = in_array( $wp_query->query_vars['taxonomy'], array( 'attachment_category', 'attachment_tag' ) ); if ( $is_media_archive ) { if ( isset( $_REQUEST['use_mla_gallery'] ) ) { $use_mla_gallery = true; } else { $use_mla_gallery = false; $args = array_merge( $wp_query->query_vars, array( 'post_type' => 'attachment', 'post_status' => 'inherit' ) ); query_posts( $args ); } } ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( $use_mla_gallery ) : ?> <?php get_template_part( 'content', 'mla-gallery' ); ?> <?php elseif ( have_posts() ) : ?> <header class="archive-header"> <h1 class="archive-title"><?php if ( is_day() ) : printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' ); elseif ( is_month() ) : printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' ); elseif ( is_year() ) : printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' ); elseif ( $is_media_archive ) : _e( 'Media Archives', 'mla-child-theme' ); else : _e( 'Archives', 'twentytwelve' ); endif; ?></h1> </header><!-- .archive-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /* Include the post format-specific template for the content. If you want to * this in a child theme then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ if ( $is_media_archive ) { get_template_part( 'content', 'media' ); } else { get_template_part( 'content', get_post_format() ); } endwhile; twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
It relies on two additional template parts. Here is
content-media.php
:<?php /** * The template for displaying posts in the Image post format, * called from the taxonomy.php template. * * @package Media Library Assistant * @subpackage MLA_Child_Theme * @version 1.00 * @since MLA 1.80 */ global $post; ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <a href="<?php the_permalink(); ?>" rel="bookmark"> <h1><?php the_title(); ?></h1> <h2><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo get_the_date(); ?></time></h2> </a> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
And the last part,
content-mla-gallery.php
:<?php /** * The template for displaying posts in the Image post format, * called from the taxonomy.php template. * * @package Media Library Assistant * @subpackage MLA_Child_Theme * @version 1.00 * @since MLA 1.91 */ <header class="archive-header"> <h1 class="archive-title"> MLA Gallery for <?php echo $wp_query->query_vars['term']; ?> in <?php echo $wp_query->query_vars['taxonomy']; ?> <?php echo do_shortcode( sprintf( '[mla_gallery %1$s="%2$s" mla_caption="{+title+}" mla_debug=false]', $wp_query->query_vars['taxonomy'], $wp_query->query_vars['term'] ) ); ?> </h1> </header>
With these templates in my theme I can get a traditional “archive” page for the
attachment_category
andattachment_tag
taxonomies. If I adduse_mla_gallery
to the URL, e.g.,https://mladev/attachment_category/mineral/?use_mla_gallery=true
I get a page with a gallery of the selected images.I know this is a lot of code and detail. I would be happy to work with you to adapt it to your theme and application needs. If you send me your contact information I can give you an e-mail address where you can send me your
archive.php
,tag.php
,category.php
andtaxonomy.php
templates, or whatever templates your theme uses for archive pages. You can use the Contact Us page at our web site:Thank you for your patience and persistence with this topic. I am confident we can get a solution that works for your application.
David,
Wow! Great explanation indeed!
This will surely help me sort things out or at least a great starting point. I didn’t pay attention to the plugin folder ;-( Haven’t been using the plugin for that long…
I have been playing with mla_gallery for a client and created a alternate markup template that let’s users download an image and option to select multiple images that will be zipped after hitting download button at the bottom of the page. Example can be viewed at: https://www.watericonen.nl/beeldbank/
Thanks for your extensive feedback.
P.S.: these kind of answers would be great if they were on a seperate website. Looks like you loose a lot of time linking to existing support requests where you answered it already. The support page is pretty large in the meantime and takes some effort to browse all possible solutions….
Thanks for your update and the link to the example site. There are some great images there, and I really like the “download a ZIP archive” idea for multiple images.
Please let me know if I can be of any further help with your application.
I would love to have the time and talent to put up a separate site with more support materials. This plugin has been a part-time volunteer effort and I keep thinking that after I’ve added one or two more features I will have more time to spend on something like that. Of course, as the customer base expands I get more ideas for new features, and on it goes.
Thanks again for your interest in the plugin.
David,
Got the cloud and gallery working, but initially the page outputs ‘Nothing to show’ because no variable is passed yet from the tag_cloud link.
Would it be possible to initially load a collection of att categories and once a tagcloud variable is passed it will use just this single variable?
Replaced the bad-term with all categories, so it shows all images on page load when there is no term_slug querystring. Very nice!
Results on the same URL as in previous post above.
Only wondering how to eliminate the variable font-size based on the nbr of items. I use mla_output=list and i just want a straightforward
- without the variable font size. Can you advice?
Thanks!
David,
If you are interested in the zip archive download ‘add-on’ i created, let me know and i can share the code with you.
Think this would be a nice add-on for your plugin as there are very little or even no add-ons that can do this in WordPress. Found 1 plugin that extends NextGen gallery plugin with this functionality. But the cool thing is that with your plugin you can easily configure the file it will use to zip (medium, large, full) with the Markup template. So, very flexible!
Could make your plugin even more popular and invites more people to donate to your plugin…..
Let me know!
Marcellino
Marcellino,
Thanks for your updates – it looks like you are making good progress on your application.
To control the initial display and avoid the “nothing to show.” message you can replace
a-bad-term
with the slug for any term that has the images you want in your initial display. You can display more than one term as well; just separate each slug with a comma. You can also replace the entire template withattachment_category="{+request:term_slug+}"
if you want to show all of your images until a term is picked; showing everything is the default when the term is empty.You can customize the cloud display with several parameters listed in the “Tag Cloud Item Parameters” section of the /Settings/Media Library Assistant Documentation tab. For example, you can make all of the terms the same size by adding something like
smallest=11 largest=11
to your shortcode. If you want complete control over your cloud you can develop custom style and markup templates for it.I would be happy to see your ZIP archive code and consider adding it to MLA. If you send me your contact information I will give you an e-mail address you can use to get it to me. Thanks for your generous offer.
Hi David, could you post your contact method so that activecontent does not have to post his?
@andrew – thanks for removing Marcellino’s address from the forum.
I regret the confusion. My customary method for exchanging contact information is to post a link to our web site. In an earlier post I suggested:
You can use the Contact Us page at our web site:
That suggestion got lost in the growing trail of replies…
In fact, I now have Marcellino’s contact information and I have replied to him.
- The topic ‘Att Categories menu returns 404 error’ is closed to new replies.