• Resolved Zepzilia

    (@zepzilia)


    This may come as an stupid question, but I am a WP newbie.

    I got this photo archive with over 600 images. I want to add a page in my blog where people can come in and search for the terms of their interest in a search box (i.e. cars, ambulances, trucks). I see there is the [mla_gallery] shortcode but I cannot find a field where I can add what I need. could you tell me where is it?

    Thanks in advance.

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Author David Lingren

    (@dglingren)

    It is very helpful to see all of the shortcodes in one place; thanks.

    First, I notice a difference between your “pagination” shortcode, which contains posts_per_page=2, and your “gallery” shortcode, which contains posts_per_page=40. The posts_per_page= parameter must be the same in both shortcodes so the two shortcodes agree on how many pages are in the entire gallery.

    Second, it looks like both of your pagination shortcodes still contain mla_link_href="{+page_url+}?term_slug; for the Spanish page they must be changed to mla_link_href="{+page_url+}&term_slug.

    You should make both of the above corrections, but they will not solve the rest of the problem, substitution of “%38” for “&” and “%3D” for “=“. I have a new theory about that and an experiment for you to try. Please put <code></code> delimiters around your shortcodes, i.e.:

    <code>[mla_gallery post_mime_type=all post_parent=all attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="No pages to show." posts_per_page=2 mla_output="paginate_links,prev_next" mla_link_href="{+page_url+}&term_slug={+request:term_slug+}"]</code>

    You may be having the same WordPress bug I have seen in other topics, such as:

    Can’t figure out how to use date_query

    Give these fixes a try and post an update. Thanks for your persistence on this adventure.

    Thread Starter Zepzilia

    (@zepzilia)

    First I did as you said, adding the <code></delimiters> around my shortcodes.

    Later I did as you told me, to replace the {+page_url+}?term_slug for mla_link_href="{+page_url+}&term_slug.

    It still wasn’t working until I wondered what if I replaced the mla_link_href="{+page_url+}?search-string={+request:search-string+} for a mla_link_href="{+page_url+}&search-string={+request:search-string+}"and voilá! Magic happened! I have no idea why, but I still will leave the code just in case is useful for anyone:

    <form id="mla-search-form" action="https://www.enriquemetinides.com/esp/?page_id=15" method="post"><input id="mla-search-box" name="search-string" type="text" value="" />
    <input id="submit" name="submit" type="submit" value="BUSCAR" /></form>
    <h3></h3>
    <h3>Galería</h3>
    <code>[mla_gallery post_mime_type=all post_parent=all s="{+template:({+request:search-string+}|a-bad-term)+}" mla_nolink_text="No pages to show." posts_per_page=21 mla_output="paginate_links,prev_next" mla_link_href="{+page_url+}&search-string={+request:search-string+}"]</code>
    
    <code>[mla_gallery post_mime_type=all post_parent=all s="{+template:({+request:search-string+}|a-bad-term)+}" mla_nolink_text="Ingrese uno o varios términos para desplegar la galería" posts_per_page=21]</code>
    
    ?
    <h3>Nube de etiquetas</h3>
    <code>[mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}&term_slug={+slug+}"]</code>
    <h3>Galería</h3>
    </code>[mla_gallery post_mime_type=all post_parent=all attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="No pages to show." posts_per_page=2 mla_output="paginate_links,prev_next" mla_link_href="{+page_url+}&term_slug={+request:term_slug+}"]</code>
    
    <code>[mla_gallery post_mime_type=all post_parent=all attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="Haz click en el término que te interesa" posts_per_page=21]</code>

    Certainly this is like a Serindipity to me. Thank you so much for all your help!

    Plugin Author David Lingren

    (@dglingren)

    Thank you for your update with the excellent news on the resolution of this issue. Your final fix is exactly right; everywhere you use the {+page_url+} on the Spanish page you must use the ampersand in place of the question mark to add query arguments like search-string or term_slug. Good detective work!

    In the final code you posted I still see different values for your posts_per_page parameter. In the first (pagination) shortcode it is posts_per_page=2 and in the second (gallery) shortcode it is posts_per_page=21. You must change one or both of these so they have the same value.

    I am marking this issue resolved, but please update it if you have any more trouble with the link formatting aspects of your application. Thanks again for your persistence, your patience and for your interest in the plugin.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Add searc box to Gallery’ is closed to new replies.