• Resolved wanderingeyedog

    (@wanderingeyedog)


    I love the plugin, and appreciate all the time you put into supporting it!
    I’m using the following shortcode to display a MLA Tag Cloud of attachment tags.
    It displays, however the links don’t work. When you click on any of them it returns a “Nothing found” page.
    I’m using the following shortcode:
    [mla_tag_cloud taxonomy="attachment_tag"]

    I’m still new to the plugin, so I was wondering if i should correct my MLA shortcode taxonomy? Or should I somehow use mla_link_href? It would be nice if it would work like my search, pull up every page with a hit on that tag… can this be done?

    Or is this a matter of Or is this outside the scope of the plugin, and rather an issue related to my WordPress Media configuration?

    The page I need help with: [log in to see the link]

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

    (@dglingren)

    Thanks for the positive feedback and for your question. I assume you want to use the tag cloud to filter an [mla_gallery] display, selecting items assigned to the cloud term when it’s clicked on; is that right?

    The [mla_tag_cloud] shortcode follows the conventions set by corresponding WordPress functions. In particular, the default action taken when a term is clicked on is to display the “archive page” for that term. Sadly, unless you change the code in your theme the “archive page” filters out Media Library items and gives you the “Nothing found” result.

    For MLA applications the more common approach is to add link=current or to use mla_link_href to generate a custom link. There are some simple examples of this approach in earlier topics:

    Tag cloud and gallery : fixed font-size?

    Need help

    Simple image gallery filtered by att. tag

    I hope that gets you started on a solution for your application. I am marking this topic resolved, but please update it if you have problems or further questions regarding adapting the examples in the earlier topics. Thanks for your continued interest in the plugin.

    Thread Starter wanderingeyedog

    (@wanderingeyedog)

    I don’t understand exactly what you mean by

    want to use the tag cloud to filter an [mla_gallery] display, selecting items assigned to the cloud term when it’s clicked on

    No, I don’t think so.

    I just want to create a tag cloud where each link goes to a list of attachments (songs) by each artist. Or at least goes to some form of content other that a “nothing found” page.

    I looked at the resources you provided and I still couldn’t figure out a shortcode.

    Thread Starter wanderingeyedog

    (@wanderingeyedog)

    I think I understand, I will need to add code to my archive pages to include Media Library items?

    But there is a workaround, link=current and mla_link_href ?
    Do you think you could help me use mla_link_href to link to the search feature with GET?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to read through the earlier topics and for your additional questions.

    You do not need to modify your theme’s code (unless you want to). The most common solution for an application like yours is to create a page, add the tag cloud to it and then add one or more [mla_gallery] shortcodes to the same page to display the “ list of attachments (songs) by each artist“. The earlier topics have examples of this approach, such as in:

    MLA Gallery Shortcode

    For your application, I assume your songs are contained in PDF documents; is that right? If not, how are they stored in the Media Library?

    For the PDF document case you can adapt the shortodes in the earlier topic and try something like this:

    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type=application/pdf
    mla_link_href="[+page_url+]?current_id={+term_id+}"
    number=0 smallest=12 largest=12 separator=' / '
    [/mla_tag_cloud]
    
    [mla_gallery]
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type=application/pdf
    columns=3 posts_per_page=20 size=none link=file 
    [/mla_gallery]
    
    [mla_gallery]
    mla_output="paginate_links,prev_next"
    mla_link_class="nav-links"
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type=application/pdf
    posts_per_page=20
    [/mla_gallery]
    

    The mla_link_href parameter links back to the current page and passes the current_id value to the two shortcodes that display the list and the pagination controls.

    I suggest you create a page with these three shortcodes and play around with it. Post an update here if you have problems or further questions regarding adapting the above example.

    Thread Starter wanderingeyedog

    (@wanderingeyedog)

    Okay, that worked! However it links directly to the MP3 file instead of the attachment page. There’s probably an easy fix, but I can’t figure it out. Here is my shortcode:

    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type="audio"
    mla_link_href="[+page_url+]?current_id={+term_id+}"
    number=0 smallest=12 largest=12 separator=' / '
    [/mla_tag_cloud]
    
    [mla_gallery]
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type="audio"
    columns=3 posts_per_page=20 size=none link=file 
    [/mla_gallery]
    
    [mla_gallery]
    mla_output="paginate_links,prev_next"
    mla_link_class="nav-links"
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type="audio"
    posts_per_page=20
    [/mla_gallery]
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news on your progress.

    To link to the attachment/media page you can simply remove the link=file parameter from the shortcode. I believe you could also change it to link=page; check the Settings/Media Library Assistant Documentation tab for more information on the link= parameter.

    Thread Starter wanderingeyedog

    (@wanderingeyedog)

    Hi David, I need your support again…
    When I updated my Media Library Assistant plugin this short code broke, and it now displays incorrectly. It dumps all of the files underneath the cloud even when you haven’t clicked on any of the tags. Also, when I click on one of the attachment page links it now comes up “Page Not Found.”

    Here is my shortcode:

    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type="audio"
    mla_link_href="[+page_url+]?current_id={+term_id+}"
    number=0 smallest=12 largest=40 separator=' / '
    [/mla_tag_cloud]
    [mla_gallery]
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type="audio"
    columns=3 posts_per_page=500 size=none
    [/mla_gallery]
    [mla_gallery]
    mla_output="paginate_links,prev_next"
    mla_link_class="nav-links"
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'id', 'terms' => array( {+request:current_id+} ) ) )"
    post_mime_type="audio"
    posts_per_page=500
    [/mla_gallery]

    Thanks in advance!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and for including the complete source text of your shortcodes; very helpful.

    The solution for your “dumps all of the files” issue can be found in this recent topic:

    Warning: array_key_exists()

    I am not sure why the issue has come up, but the solution for your shortcode is to change your tax_query parameter slightly. Replace:

    {+request:current_id+}
    

    with:

    {+template:{+request:current_id+}|1+}
    

    The changes are to both of the ‘terms’ => tax_query parameters. I have added a template that supplies a default term ID (‘1’) when the {+request:current_id+} value is empty. The default won’t match any items and the display will be empty.

    You wrote “when I click on one of the attachment page links it now comes up “Page Not Found.” “ On my system your shortcodes go to the “Media Page” for the item when I click on an item in the gallery display. If this problem persists after you fix the initial display issue, post a link to the page on which the problem occurs and I will investigate further.

    You might also consider adding a minimum=1 parameter to your tag cloud to eliminate terms which have no audio files assigned to them.

    I will leave this topic unresolved until I hear back from you.

    Thread Starter wanderingeyedog

    (@wanderingeyedog)

    Perfecto! The addition of the modification worked as it was before! Thanks again David! GREAT plugin!!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Unsure how to use mla_tag_cloud for attachment taxonomy’ is closed to new replies.