• Resolved lastqa

    (@lastqa)


    I’m seeing some strange behaviors in tag-cloud recently, though not really sure if they have been there all along or not…

    At first I thought this only applied to attachment tags that had a space in the name, so was searching (so far saucerful) for a solution there but then now I find some spaced tags that work and can’t figure out why some and not the others…

    The gallery code is:

    [mla_gallery]
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'name', 'terms' => array( {+request:current_name+} ) ) )"
    post_mime_type=image
    orderby=date order=DESC
    mla_caption=' '
    columns=5 posts_per_page=20 size=thumbnail link=file 
    [/mla_gallery]

    and the tag cloud code is:

    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type=image
    mla_link_href="/images-by-tags/?current_name={+name+}"
    minimum=2 number=200 smallest=8 largest=16 separator=' - '
    [/mla_tag_cloud]

    “horse racing” and “pumpkin patch” work, but “race track” and “walk-the-winds” come up blank. “sun glasses” pulls up the images for “glasses” (which works properly) and not it’s own images.

    Ideally I’d like to know why some are working and others aren’t but for all the broken tags, if I manually add quotes the URL they then show the correct images in the gallery so I’m thinking adding quotes to the link would be a perfectly viable work around if anyone can tell me how to make that work…

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

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

    (@dglingren)

    Thanks for your question and for all the work you’ve done to find the source of the problem. Thanks as well for the link to your example page; very helpful.

    Your instinct about spaces was a good one. If you look at the URLs behind the links in your tag cloud you will see that the spaces and other special characters are not properly URL-encoded. There’s no good reason to use the name field for your application. You would be better off using the slug, which is sanitized in a way that fits URL encoding rules. You could also try changing {+name+} to {+name,url+} to properly encode that values, but I don’t see this having any advantage over just using the slug.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.

    Thread Starter lastqa

    (@lastqa)

    I used name instead better readability for visitors and in site activity but slug is probably close enough.

    Unfortunately changing all instances of name to slug in the code broke all of the multiword tags including those that were working as name…

    ‘[mla_gallery]
    post_mime_type=”none”
    mla_nolink_text=”{+template:(<h2>Images tagged with {+request:current_slug+}</h2>)+}”
    [/mla_gallery]’

    [mla_gallery]
    tax_query= "array ( array ( 'taxonomy' => 'attachment_tag', 'field' => 'slug', 'terms' => array( {+request:current_slug+} ) ) )"
    post_mime_type=image
    orderby=date order=DESC
    mla_caption=' '
    columns=5 posts_per_page=20 size=thumbnail 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' => 'slug', 'terms' => array( {+request:current_slug+} ) ) )"
    post_mime_type=image
    posts_per_page=20
    [/mla_gallery]
    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type=image
    mla_link_href="/images-by-tags/?current_slug={+slug+}"
    minimum=2 number=200 smallest=8 largest=16 separator=' - '
    [/mla_tag_cloud]
    • This reply was modified 1 year, 11 months ago by lastqa.
    Thread Starter lastqa

    (@lastqa)

    deleted double post – gateway timeout

    • This reply was modified 1 year, 11 months ago by lastqa.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the updated shortcodes and problem report. I have copied your shortcodes to my system and made some changes that should give you better results.

    The immediate problem is the array( {+request:current_slug+} ) parameter in your tax_query. replacing that with '{+request:current_slug+}' works fine; note the single quotes enclosing the substitution parameter.

    However, you can replace the entire tax_query with a simple taxonomy query, attachment_tag={+request:current_slug+}. That works fine, too, and is somewhat shorter.

    You can also improve your heading by adding the term name to your tag cloud shortcode. Here are my versions of your shortcodes:

    <h2>[mla_gallery ids=1 mla_nolink_text="{+template:(Images tagged with {+request:current_name+})+}"][/mla_gallery]</h2>
    
    [mla_gallery]
    attachment_tag={+request:current_slug+}
    orderby=date order=DESC
    mla_caption=' ' columns=5 posts_per_page=20 size=thumbnail link=file
    [/mla_gallery]
    
    [mla_gallery]
    mla_output="paginate_links,prev_next"
    mla_link_class="nav-links"
    attachment_tag={+request:current_slug+}
    posts_per_page=20
    [/mla_gallery]
    
    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type=image
    mla_link_href="/images-by-tags/?current_slug={+slug+}&amp;current_name={+name,url+}"
    minimum=2 number=200 smallest=8 largest=16 separator=' - '
    [/mla_tag_cloud]
    

    Give those update a try and let me know how they work for you. Thanks for your persistence.

    Thread Starter lastqa

    (@lastqa)

    Your code worked perfect! I think I’m learning, slowly but couldn’t at all without your help. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Strange behaviors from tag cloud/gallery’ is closed to new replies.