Support » Plugin: Media Library Assistant » Using Tag Cloud with categories & tags

  • Resolved cuckoofairweb

    (@cuckoofairweb)


    My gallery is up and working but using manual links to pages hard coded to display select category / tag – https://cuckoofair.co.uk/new-gallery.

    Here’s the mapping rules for the EXIF data
    TITLE – template:([+exif:Artist+])( at [+exif:Keywords+])( in [+exif:DateTimeOriginal,date(‘Y’)+])
    ALT TEXT – template:(© [+exif:Copyright+])
    UPLOADEDON DateTimeOriginal
    Att. Categories template:([+exif:Artist+], Gallery Photo, )([+exif:Keywords+])
    Att. Tags template:([+exif:DateTimeOriginal,date(‘Y’)+])
    All with EXIF Priority and Replace. The caption / description fields are set to empty using template:[+empty+]

    I started experimenting with the tag cloud and have made some progress – https://cuckoofair.co.uk/new-gallery/gallery-tag-cloud.

    Here’s the shortcodes for the tag cloud display:
    [mla_tag_cloud taxonomy=”attachment_category,attachment_tag” number=0 post_mime_type=image/jpeg include=”86,76,79,68,78,116,77,146,147,144,150,145,88,85,83,87,80,71,81,112,105,142,118,119,120,106,107,149,121,108,109,153,152″ separator=” | ” mla_link_href=”{+page_url+}?current_id={+term_id+}&mla_cloud_current={+request:mla_cloud_current+}”]

    [mla_gallery post_mime_type=all tax_query=”array ( 0 => array ( ‘taxonomy’ => ‘attachment_category’, ‘field’ => ‘id’, ‘terms’ => array( {+request:current_id+} ), ‘include_children’ => false ) )” mla_caption=”{+title+}” orderby=date order=ASC columns=1 size=icon link=file mla_alt_shortcode=justified_image_grid]

    The long includes line is to exclude some images / documents used elsewhere on the web site that are not for the gallery.

    I have some questions:
    1 Although the tag values (ie the years) are displayed with the number of items in the hover text – clicking on them has no effect. I did try to add attachment_tags to the array but that had no effect!
    2 Clicking on a category (ie the types of performers / locations) correctly displays the photos but this warning appears above:
    “Warning: A non-numeric value encountered in /homepages/2/d451850435/htdocs/app451850410/wp-content/plugins/media-library-assistant/includes/class-mla-shortcode-support.php on line 2016”
    3 Rather than manually listing all the Term-ids of the categories in the long Include line is it possible to select the ‘parent’ of the categories (in my case Location and Performer) and for MLA to auto include all the children of that category parent?

    My website environment is MLA version – Version 2.81 on WordPress version 5.3.

    Many thanks in advance

    Paul

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

    (@cuckoofairweb)

    Hi, by way of an update the warning message was fixed when I realised I had poorly copied over the paginated code so it now reads:

    [mla_tag_cloud taxonomy=”attachment_category,attachment_tag” number=0 post_mime_type=image/jpeg exclude=”70,97,73,74,151,74,75,96,110″ separator=” | ” mla_link_href=”{+page_url+}?current_id={+term_id+}”]

    which works fine.

    I did some research on the tax_query coding and tried:
    tax_query=”array (
    ‘relation’ => ‘OR’,
    0 => array ( ‘taxonomy’ => ‘attachment_category’,
    ‘field’ => ‘id’,
    ‘terms’ => array( {+request:current_id+} ),
    ‘include_children’ => false,
    ),
    0 => array ( ‘taxonomy’ => ‘attachment_tag’,
    ‘field’ => ‘id’,
    ‘terms’ => array( {+request:current_id+} ),
    ),
    )”
    with the aim of passing the term_id to both the category and tag queries – as the numbers are unique across both only one of the arrays would return with the array of ids but that did nothing…

    cuckoofairweb

    (@cuckoofairweb)

    Just tried again and tided up the code by removing the 0 => (no idea what they did!] and this:
    [mla_gallery]
    post_mime_type=image/jpeg
    tax_query=”array (
    ‘relation’ => ‘OR’,
    array ( ‘taxonomy’ => ‘attachment_category’,
    ‘field’ => ‘id’,
    ‘terms’ => array( {+request:current_id+} ),
    ‘include_children’ => false,
    ),
    array ( ‘taxonomy’ => ‘attachment_tag’,
    ‘field’ => ‘id’,
    ‘terms’ => array( {+request:current_id+} ),
    ),
    )”
    mla_caption=”{+title+}”
    orderby=date
    order=ASC
    size=icon
    link=file
    mla_alt_shortcode=justified_image_grid
    [/mla_gallery]

    seems to be working.

    are the 0 => important ?

    Paul

    Plugin Author David Lingren

    (@dglingren)

    Paul,

    Thanks for your posts and for your persistence in working with the [mla_tag_cloud] shortcode. I had a look at your /new-gallery/gallery-tag-cloud test page and it looks like you’ve got everything working; congratulations!

    Regarding your final question, “are the 0 => important ?“, the answer is no, they are not. They give an array index value to the two array specifications that follow them. In fact, because both of the arrays were preceded by the same index value, only the last one actually made it into the final query. Removing them was the right solution.

    I am marking this topic resolved because you’ve worked through the earlier problems you encountered. Please update the topic if you have any remaining problems or further questions about combining the MLA shortcodes for your “cloud and gallery” application.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.