• Resolved ageingdj

    (@ageingdj)


    Hi there,
    A simple newbie question:
    I simply want to show all the images (all jpeg) grouped by category and sub-category?
    Secondly, A summary of just the categories/sub titles and count of images.
    Third, Expand that summary by making the category “clickable” (or a dropdown list) ie: when the category is clicked it expands to show the images.
    I’m sure you you have shortcodes for these but I can’t see them.
    I hope this makes sense.
    Thanks
    Paul M

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

    (@dglingren)

    Thanks for your questions.

    Your first question is actually the most interesting/difficult. You wrote “show all the images (all jpeg) grouped by category and sub-category“. There is no MLA shortcode or other feature that will iterate through all the terms in a taxonomy and display galleries of the items assigned to each term. I assume that each gallery would have to be introduced by a heading or description that gave the term that the gallery items are assigned to.

    My sense is that once you get past a handful of terms and a few dozen images the page would get very long and performance would suffer. A small custom plugin with some PHP code could do the job if it really makes sense for your application. I can give you more specific help if that seems realistic.

    Your second and third questions are more in line with other applications and support topics. It is very common to display a list of taxonomy terms in some fashion, let the user make a selection and them display a gallery of the matching items. This is the motivation of MLA’s [mla_tag_cloud] and [mla_term_list] shortcodes. You can find more information and simple examples of these shortcodes in the “Tag Cloud Pagination Example” and “MLA Term List Examples” sections of the Settings/Media Library Assistant Documentation tab. The basic approach is to use one shortcode to select a term and pass it to the [mla_gallery] shortcode to compose the display.

    You might also find this earlier topic and the topics it gives links to useful:

    Gallery Hierarchy – Parent>Child>Grandchild

    I hope that gets you started on a solution for your application. I am traveling for the next week but if you have problems or further questions regarding the above suggestions, post an update and I will have another look when I return home. Thanks for your interest in the plugin.

    Thread Starter ageingdj

    (@ageingdj)

    Hi David,
    Thanks for taking the time for such a detailed reply.
    I’m afraid that I’m even more confused now.
    Both [mla_tag_cloud] & [mla_term_list] give me a summary list of Post tags – what I want is the Media Categories.
    Also, the link you gave has gone way over my head! I can’t see anything like the shortcode I want (not all of us are techie coders).
    Many thanks
    PS My first original question was a bit daft – I have 900 images!

    Thread Starter ageingdj

    (@ageingdj)

    I’ve just spent over an hour on this and I still can’t get any kind of category filter for MLA_gallery.
    Can I have some examples please: Two of my category trees are “Out and About”/”Events”/”Ceramics” (slug: “outandabout”/”events”/”ceramics”) and “New Camera”/”Light Trials” (“newcamera”/”lighttrials”) there are images in both of the lowest categories.
    I can’t figure this out.
    Thanks
    Paul M

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates, and thanks for taking the time to read thru the material I suggested and try the solutions there. MLA’s shortcodes are powerful and flexible but they do require some work to understand and apply. I know the Documentation is more reference than tutorial, but I hope the examples there can help.

    Did you find the “MLA Term List Examples” sections of the Settings/Media Library Assistant Documentation tab? The first example there should give you a dropdown control to select a term from your taxonomy with a “Search” button that generates a gallery of the items assigned to the term you select in the text box.

    Let’s look at the first shortcode:

    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" show_count=true pad_counts=false ]
    

    The parameters for this shortcode are:

    • taxonomy=attachment_category – displays terms from the “Att. Category” taxonomy
    • mla_output=dropdown – formats the list of terms as a dropdown control
    • mla_option_value=”{+slug+}” – returns the term slug from the dropdown control
    • show_count=true – shows the number of items assigned to each term
    • pad_counts=false – counts only the items assigned to the term itself, not its children

    You wrote that the shortcodes “give me a summary list of Post tags – what I want is the Media Categories.” Did you add the taxonomy parameter to your shortcode? When you write “Media Categories”, do you mean the Att, Categories taxonomy that MLA provides or another taxonomy? Some other plugins create a taxonomy labeled “Media Categories” – are you using one of those? If so, you have to change the taxonomy slug to something like “media-categories” or “media_category”, depending on what the other plugin uses. If you click the taxonomy you want in the “Media” admin section you can see the slug value in the URL at the top of the browser window.

    The examples in the MLA Documentation tab include HTML tags, e.g., for the form that surrounds the dropdown control. To enter the special characters in the examples you must use the “Code Editor”, not the default “Visual Editor”. To select the Code Editor in the new “Gutenberg” editor, click on the three vertical dots in the upper-right corner of the screen, then click the “Code Editor” entry in the “Editor section of the settings bar.

    If you get the taxonomy slug right and use the Code Editor to enter the example you should get a good result. Give the above suggestions a try and let me know how they work for you. My response may be delayed while I’m on the road but I will give you more specific help as I can. Thanks for your patience.

    Thread Starter ageingdj

    (@ageingdj)

    Hi David,
    Thanks again for all your help.
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" show_count=true pad_counts=false ]
    works perfectly – it gives a list of my media categories with a count of media items.
    Buthow do I use “{+slug+}” to show the images in the selected category?
    I found this:

         [mla_gallery attachment_category=big-dog posts_per_page=12]
         
        [mla_gallery attachment_category=big-dog posts_per_page=12 mla_output="paginate_links,prev_next"] 

    I’ve tried every variation of “{+slug+}” but all that happens is a list of all my media displayed in blocks of 12. I tried this as HTML and shortcode but no difference.
    Help (with examples) please
    Thanks and sorry to be such a pain.
    Paul

    • This reply was modified 5 years, 8 months ago by ageingdj.
    Thread Starter ageingdj

    (@ageingdj)

    Update: More by luck than anything else I’ve come across a html that works!
    [mla_gallery tax_query="array(array('taxonomy'=>'attachment_category','field'=>'slug','terms'=>'ceramics'),array('taxonomy'=>'attachment_tag','field'=>'slug','terms'=>'animal'),'relation'=>'OR')"]
    Returns all the images with a category of “ceramics” but I’m stumped how to pass the resulting variable from the drop-down (mla_option_value="{+slug+}")into the html.
    I must be pretty close.
    Paul
    (Answers with the shortcode please)

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates and especially for your persistence in experimenting with the shortcodes to find a solution. I hope the educational recreation value has been greater than the frustration.

    As you wrote, the trick is passing the selected term from the dropdown control to the gallery shortcode. Going back to the example in the MLA Documentation, the solution is given as:

    [mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=3 mla_caption="{+title+} : {+description+}" mla_nolink_text="<br>Select a term to display the gallery.<br>"]
    

    The key part of the example is:

    attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}"

    In this example, the {+request:tax_input.attachment_category+} portion contains the slug value of the selected term. The request: prefix tells MLA to look in the in the HTML request variables; the tax_input portion names the query argument to look for. Since tax_input is an array, the .attachment_category portion names the array element that contains the slug you want.

    The rest of the parameter value is a Content Template that lets you specify what should happen when the page is first displayed and no term is selected. In this example, no-term-selected is used as a default rems slug. Since it doesn’t match any real term, an empty gallery is replaced by the mla_nolink_text="<br>Select a term to display the gallery.<br>" value.

    So, your first shortcodes should work if you change them to:

    [mla_gallery attachment_category="{+request:tax_input.attachment_category+}" posts_per_page=12]
         
    [mla_gallery attachment_category="{+request:tax_input.attachment_category+}" posts_per_page=12 mla_output="paginate_links,prev_next"] 
    

    The above will show all (or twelve) of your items when the page is first displayed. If you want an empty gallery on the first display, use:

    [mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=12]
         
    [mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=12 mla_output="paginate_links,prev_next"] 
    

    Your second, longer shortcode should also work if you change 'animal' to '{+request:tax_input.attachment_category+}' or '{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}'. The second example will match the selected term in either the attachment_category or the attachment_tag taxonomies, although the dropdown control will not include terms found only in the attachment_tag taxonomy. There is a way to add those terms if it is important for your application.

    I hope the above suggestions will give you the last bit of the solution you need; as you wrote, you’re very close. Let me know how they work out, and thanks again for keeping at it!

    Thread Starter ageingdj

    (@ageingdj)

    Hi David,
    Sorry, but you’ve completly lost me again.
    Your examples:
    So, your first shortcodes should work if you change them to:
    [mla_gallery attachment_category=”{+request:tax_input.attachment_category+}” posts_per_page=12]
    [mla_gallery attachment_category=”{+request:tax_input.attachment_category+}” posts_per_page=12 mla_output=”paginate_links,prev_next”]

    Only shows the first page of 75 with 12 per page.

    Example 2:
    If you want an empty gallery on the first display, use:
    [mla_gallery attachment_category=”{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}” posts_per_page=12]
    [mla_gallery attachment_category=”{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}” posts_per_page=12 mla_output=”paginate_links,prev_next”]

    Only shows the first page of 75 with 12 per page.

    3rd example:
    Your second, longer shortcode should also work if you change ‘animal’ to ‘{+request:tax_input.attachment_category+}’ or ‘{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}’
    Which gives:
    [mla_gallery tax_query="array(array('taxonomy'=>'attachment_category','field'=>'slug','terms'=>'ceramics'),array('taxonomy'=>'attachment_tag','field'=>'slug','terms'=>'{+request:tax_input.attachment_category+}'),'relation'=>'OR')"]
    and
    [mla_gallery tax_query="array(array('taxonomy'=>'attachment_category','field'=>'slug','terms'=>'ceramics'),array('taxonomy'=>'attachment_tag','field'=>'slug','terms'=>'{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}'),'relation'=>'OR')"]
    Both of these take no notice of the category chosen (because the term “ceramics” hasn’t changed) and show the 34 ceramics images which makes sense
    All these shortcodes were entered in the HTML block.

    I’m getting to the point of thinking this doesn’t work
    The page is my experimental page
    Paul

    Plugin Author David Lingren

    (@dglingren)

    Thanks for following up. I regret that my last post was incomplete.

    You must also change 'ceramics' in your first terms= argument. Try this:

    [mla_gallery tax_query="array(array('taxonomy'=>'attachment_category','field'=>'slug','terms'=>'{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}'),array('taxonomy'=>'attachment_tag','field'=>'slug','terms'=>'{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}'),'relation'=>'OR')"]
    

    If you are not also trying to match terms in your “Att. Tags”/attachment_tags taxonomy you can remove the second part of your query:

    [mla_gallery tax_query="array(array('taxonomy'=>'attachment_category','field'=>'slug','terms'=>'{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}'))"]
    

    Either of the above should give you a better result.

    Thread Starter ageingdj

    (@ageingdj)

    SorryDavid,
    Neither of these worked, they just gave a blank result.
    Paul

    Plugin Author David Lingren

    (@dglingren)

    Thanks for giving them a try. I am sorry to see you’re still having trouble with them.

    It’s possible that some small syntax problem is preventing the dropdown control from passing the selection to the gallery shortcodes. If you can post the complete source text of all the HTML on your post/page I can look at it in more detail.

    You can also try making an exact copy of the code given in the first example of the “MLA Term List Examples” section of the Documentation tab. Set up a test page, use the Code editor, copy the code into the page and try that.

    If neither of those suggestions work for you can contact me at my web site to continue the dialog. Thanks for your patience.

    Thread Starter ageingdj

    (@ageingdj)

    Hi David,
    There’s no email link on your website.
    I tried that code (as HTML in the Code Editor) and got the message: ERROR: Invalid mla_gallery tax_query = ‘ ‘
    This is on a new page: https://www.ageingdj.com/latest-photos-2/
    The choice from the dropdown list isn’t sticking.
    Paul
    The code is:

    <!-- wp:tadv/classic-paragraph /-->
    
    <!-- wp:cover {"url":"https://www.ageingdj.com/wp-content/uploads/2019/03/P3240152.jpg","id":3814,"dimRatio":10} -->
    <div class="wp-block-cover has-background-dim-10 has-background-dim" style="background-image:url(https://www.ageingdj.com/wp-content/uploads/2019/03/P3240152.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"huge"} -->
    <p style="text-align:center" class="has-huge-font-size"><strong>Another Test Page</strong></p>
    <!-- /wp:paragraph --></div></div>
    <!-- /wp:cover -->
    
    <!-- wp:tadv/classic-paragraph /-->
    
    <form id="mla-text-form" action="." method="post" class="row">
    <strong>Att. Categories</strong><br>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" show_count=true pad_counts=false ]<p></p>
    <p><input id="text-form-submit" name="text_form_submit" type="submit" value="Search">
    </p>
    </form>
    <h3>Gallery</h3>
    <p>[mla_gallery]<br>
    attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}"<br>
    posts_per_page=3 mla_output="paginate_links,prev_next"<br>
    mla_link_href='{+new_url+}?mla_paginate_current={+new_page+}&tax_input[attachment_category]="{+query:attachment_category,text+}"'<br>
    [/mla_gallery]</p>
    <p>[mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=3 mla_caption="{+title+} : {+description+}" mla_nolink_text="<br>Select a term to display the gallery.<br>"]</p>
    Plugin Author David Lingren

    (@dglingren)

    Thank you for setting up the test page and for including the full source text of taht page in your post; very helpful.

    Regarding your “ERROR: Invalid mla_gallery tax_query = ‘ ‘”, this is a confusing message (I haven’t found a way to improve it, sorry) that indicates an error in your shortcode syntax. If you compare the source text you posted with the original code in the Documentation tab you can see that your code has somehow become corrupted by added <br> tags between the lines in the pagination link shortcode. The first gallery shortcode must be:

    <p>[mla_gallery]
    attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}"
    posts_per_page=3 mla_output="paginate_links,prev_next"
    mla_link_href='{+new_url+}?mla_paginate_current={+new_page+}&tax_input[attachment_category]="{+query:attachment_category,text+}"'
    [/mla_gallery]</p>
    

    When I removed those tags from your code on my system it worked fine. The new Gutenberg editor has made it harder to enter HTML in posts/pages and I find that very annoying.

    I also regret the trouble you had finding the email link on my site. As described in the “MLA Support” paragraph, “If you need to send files or large amounts of supporting information you can start an email message by clicking the envelope icon at the bottom right portion of this page. Please use it gently; thank you!” Let me know if the envelope icon isn’t working for you.

    Thread Starter ageingdj

    (@ageingdj)

    Hi David,
    Now I’m confused.
    If I click on your envelope icon I get a blank Chrome page.
    I’ve reset al the code on my test page and still get the same error message (“ERROR: Invalid mla_gallery tax_query = ‘ ‘”).
    And the two codes aren’t speaking to each other, are you using the same version of Windows 10 as me (I use Firefox)?
    Paul
    The code on my page (WP keeps reinserting the <br>’s!):

    <!-- wp:cover {"url":"https://www.ageingdj.com/wp-content/uploads/2018/12/Spitalfields-Dec18-01.jpg","id":2288,"dimRatio":20} -->
    <div class="wp-block-cover has-background-dim-20 has-background-dim" style="background-image:url(https://www.ageingdj.com/wp-content/uploads/2018/12/Spitalfields-Dec18-01.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
    <p style="text-align:center" class="has-large-font-size"><strong>This is my "Try Out" page where I experiment with anything.</strong></p>
    <!-- /wp:paragraph --></div></div>
    <!-- /wp:cover -->
    
    <!-- wp:tadv/classic-paragraph /-->
    
    <form id="mla-text-form" action="." method="post" class="row">
    <strong>Att. Categories</strong><br>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" show_count=true pad_counts=false ]<p></p>
    <p><input id="text-form-submit" name="text_form_submit" type="submit" value="Search">
    </p>
    </form>
    <h3>Gallery</h3>
    <p>[mla_gallery]<br>
    attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}"<br>
    posts_per_page=3 mla_output="paginate_links,prev_next"<br>
    mla_link_href='{+new_url+}?mla_paginate_current={+new_page+}&tax_input[attachment_category]="{+query:attachment_category,text+}"'<br>
    [/mla_gallery]</p>
    <p>[mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=3 mla_caption="{+title+} : {+description+}" mla_nolink_text="Select a term to display the gallery."]</p>

    Plugin Author David Lingren

    (@dglingren)

    Thank you for your persistence and patience. I truly regret all the little problems preventing your progress on this application.

    Regarding the envelope issue. It’s possible you do not have an email client properly configured on your system; on my system the mailto: link is working without errors. If you hover over the icon you can see the address in the status line at the bottom of the browser window. I have also updated the web site with more information on how to reach me if the envelope icon just doesn’t help. Look for new text in the “MLA Support” paragraph.

    Regarding the corrupting <br> tags WordPress adds to your shortcode, I am working on some MLA changes that will repair the damage done by the new WordPress editor. If you can send me your contact information I will give you more details.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Confused Newbie’ is closed to new replies.