• Resolved globeonedev

    (@globeonedev)


    Dear David,
    Thanks again for this great plugin and your great support. I’m running the following MLA shortcodes on my pages:

    [mla_tag_cloud taxonomy=category post_mime_type=application number=0 minimum=1 mla_link_href=”/test-doc/?current_id={+term_id+}”]

    [mla_gallery]post_mime_type=application tax_query=”array ( 0 => array ( ‘taxonomy’ => ‘category’, ‘field’ => ‘id’, ‘terms’ => array( {+request:current_id+} ), ‘include_children’ => false ) )” mla_caption=’Published in {+parent_title+}‘ columns=3 size=large link=file[/mla_gallery]

    I’m trying to add a few dropdown menus between the tag cloud and the gallery using the [mla_term_list] shortcode but I can’t make it work.

    Although I can see the dropdwon menu when I add the short code it does not work when I choose a category. I’ve tried to add a submit button with no luck.

    Can you please give a full example of a working [mla_term_list] dropdown shortcode to use as a base?

    Thanks in advance

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

    (@dglingren)

    Thanks for the kind words and for your question. Dropdown controls using [mla_term_list] have been a popular subject in the forum. Here is a link to an earlier topic that contains links to three additional topics:

    Shortcode

    Combining a tag cloud with a form containing a dropdown control and submit button can be confusing. The tag cloud displays terms as hyperlinks that pass the clicked term back to the server and refreshes the page with the resulting display. The dropdown control sets a value that isn’t passed back to the server until the Submit button is clicked. There is no current way to combine the could and dropdown values in a single query/refresh action.

    Have a look at the earlier topics and let me know how I can give you more specific guidance. Thanks for your interest in the plugin.

    Thread Starter globeonedev

    (@globeonedev)

    Hello and thanks for your answer.

    I don’t want to combine the tag cloud with the drop down menus. I just want them to appear on the same page.

    The problem is that I can’t make the drop down menus to work at all even in a page without the tag cloud. All drop down forms I found in the support forums are not working. I choose the category, I press the Submit button and it shows nothing.

    Would you be kind enough to provide a working example of a dropdown menu. Just a simple dropdown menu where I can choose the categories, press the submit button and get the results?

    Thank you very much for your help

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your additional comments and clarification. Here is a simple example of a dropdown control for the Att. Categories taxonomy that I will add to the Documentation tab so others can benefit form it:

    
    <form id="mla-text-form" action="." method="post" class="row">
    <strong>Att. Categories</strong>
    [mla_term_list taxonomy=attachment_category mla_output=dropdown mla_option_value="{+slug+}" show_count=true pad_counts=false ]
    
    <input id="text-form-submit" name="text_form_submit" type="submit" value="Search" />
    </form>
    
    <h3>Gallery</h3>
    [mla_gallery attachment_category="{+template:({+request:tax_input.attachment_category+}|no-term-selected)+}" posts_per_page=3 mla_output="paginate_links,prev_next"]
    
    [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>"]
    

    As you can see, the key is passing the selected term from the form to the gallery shortcodes. By default, the [mla_term_list] shortcode collects all of its results in the tax_input array, keyed by taxonomy slug. The example combines this with an invalid term slug so the gallery will be empty until a term is selected in the dropdown.

    You will also see that the term you select doesn’t “stick” in the dropdown control when the page isrefreshed with the gallery display. That is one motivation or the “MLA UI Elements Example” plugin you’ve seen in other support topics. You can use that plugin to improve the user experience after you have got the basic application going.

    I hope the above example gets you started. Please post an update with any problems or further questions you have regarding the [mla_term_list] shortcode.

    Plugin Author David Lingren

    (@dglingren)

    Further testing has revealed a pagination problem with the solution I gave in my previous post. The selected term must be added to the pagination links that appear above the gallery display. Here is an updated version of the fist [mla_gallery] shortcode that adds that parameter:

    
    [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]
    

    Note that I have changed to the “enclosing shortcode” format so HTML characters in the mla_link_href parameter are not corrupted by the WordPress shortcode parsing process.

    By the way, you can experiment with a category checklist format by simple changing mla_output=dropdown to mla_output=checklist in the [mla_term_list] shortcode.

    • This reply was modified 9 years, 5 months ago by David Lingren.
    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.41, which includes the Documentation update adding the [mla_term_list] example.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding the [mla_term_list] example.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Problem with drop down menu’ is closed to new replies.