• Resolved Taufan

    (@taufanxxx)


    Hi David,
    Hope you are always healthy.
    I have a question:

    I know how this shortcode works:

    [mla_gallery mla_terms_phrases="art" attachment_category="indonesia"]

    My question is, how do I display a gallery with images that have a certain custom_field.

    As an example:
    my_custom_field=1111

    I tried this shortcode but it doesn’t work:

    [mla_gallery s="1111" attachment_category="indonesia"]

    I know if the search parameter (“s=keyword”) will perform a search “post_title” and “post_content” but not the “post_excerpt” (Caption) field.

    But how to search custom_field?
    did I miss something?

    Thanks for your answer.
    I am very much appreciated.
    ?

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

    (@dglingren)

    Good to hear from you again, and thanks for the kind words. Thanks as well for your question, which is a variation on these earlier topics:

    Search Media by Custom Field

    Searching on custom fields

    The example you give in your post can be solved with the “Simple Custom Field Parameters” described in the Settings/Media Library Assistant Documentation tab. For your example you can try something like:

    [mla_gallery attachment_category=indonesia meta_key=my_custom_field meta_value='1111']
    

    There are some other options you can find in the Documentation tab. You can also look at the more powerful ‘ Custom Field Queries, the “meta_query” ‘ Documentation section for additional solutions.

    Your question also mentions the more flexible keyword search parameter (s=); this is an interesting alternative. In response to the earlier topics I developed the “MLA Custom Fields Search Example” plugin, which is included in the current MLA version. The example plugin includes powerful search capabilities, settings to configure its operation and a “Documentation” tab explaining its features and operation.

    To get the example plugin, navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “custom” in the text box and click “Search Plugins” to filter the table.

    You are looking for the “MLA Custom Field Search Example” plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate the example plugin as you would any other plugin. Make sure you have the latest version, 1.06, installed.

    Once the example plugin is installed and active you can access the Settings/MLA Custom Search “Documentation” tab to learn more about the plugin and its capabilities. If you have any problems or further questions regarding the example plugin, post an update here and I can give you more specific guidance.

    The current version of the example plugin supports the admin-mode Media/Assistant and Media Manager Modal (popup) Window “Search Media” text boxes. I regret that it does not support the keyword search parameter in the [mla_gallery] shortcode. If you give the current version a try and find that it would meet your needs I can investigate the feasibility of enhancing it to support the shortcode.

    I will leave this topic unresolved until I hear back from you. Thanks for your continued interest in the plugin.

    Plugin Author David Lingren

    (@dglingren)

    I just noticed that this topic has been marked resolved since my last post. I will leave it that way, but please post an update if you have any problems or further questions regarding the suggestions in my earlier post. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to search custom_field to display gallery’ is closed to new replies.