• Resolved direys

    (@direys)


    Hi Jeff, I’m very new to WordPress and very excited to use your Media Library to display photos on my website. I have a lot of photos of various projects that I want users of my website to be able to filter based on Custom Fields I have set up.

    Specifically:
    I want to display all “portfolio” category photos in a thumbnail list, with search options on the side to filter by “Species,” “Room,” and “Finish.” Each filter would be a checklist of Custom Field Values for that Custom Field Name, and would limit the display of photos to those that match all filter parameters.

    I think your plugin will allow me to do this… can you teach me how?

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

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

    (@dglingren)

    Thanks for the kind words and for your application idea. You wrote “I’m very new to WordPress” but you don’t say how much web development experience you have. Have you done any PHP or other programming projects?

    As you have discovered, the MLA [mla_gallery] shortcode can filter a gallery display on taxonomy terms (e.g., WordPress Categories or MLA Att. Categories) and custom field values. Since you suggest “Each filter would be a checklist” have you considered using a taxonomy or taxonomies for these filters instead of custom fields? If the three filters have a controlled vocabulary a taxonomy would help enforce that. It would also be more efficient from a database storage and query standpoint. MLA can support any number of taxonomies. They can be “flat” (like tags) with a simple list of terms or “hierarchical” (like categories) with parent/child relationships. Custom fields would be “flat”.

    Either way, the solution for your application would require some straightforward PHP code added to your theme or packaged in a small custom plugin. There is no “checklist” support built in to the current MLA version, although I am working on that for my next release. Your application would make a good test case to ensure my enhancements can be applied in a practical way.

    In the interim I can put something together to get you started, but I will need some additional details from you to know how to proceed. I will leave this topic unresolved until I hear back from you. Thanks for you interest in the plugin.

    Thread Starter direys

    (@direys)

    Thanks for your reply, David. (Sorry I got your name wrong ?? )

    I have some limited programming experience, mostly with excel formulas. (I’ve also written some c++ programs and JASS scripts, although that was many years ago now)

    I think you’re right on the taxonomies. I’d certainly prefer a hierarchical, limited vocabulary option for managing my filters – I just couldn’t figure out how to set those up. (I thought the custom fields was the way to do it) Categories didn’t quite seem like the right method to me – I want each photo to have a designated “species” but I don’t want to be able to search “show me all photos categorized as ‘species’ ” … does that make sense?

    I’d love some clear instruction on how to set up taxonomies and where to apply shortcode, and how to read/parse it. (I assume that’s how I would get what I need to show filters on the front end of my website)

    Thanks again for your help,
    -Jessi

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the additional information. I know WordPress has quite a learning curve for subjects like custom taxonomies. Regarding “how to set up taxonomies“, here’s the tip of that iceberg:

    Taxonomies

    The External Resources section in the Codex page is very useful.

    There are several plugins that allow you to define and use taxonomies without PHP coding. This one looks reasonable, but I haven’t tried it:

    MB Custom Taxonomy

    Here’s a popular plugin that may be overkill:

    WCK – Custom Fields and Custom Post Types Creator

    However you do it, once your taxonomies are set up you can add MLA support from the “Taxonomy Support” section of the Settings/Media Library Assistant General tab.

    You wrote “Categories didn’t quite seem like the right method…” which I agree with. You will find that Media Library items don’t work well with the built-in WordPress Categories and Tags taxonomies; that’s why MLA adds the Att. Categories and Att.Tags taxonomies to the list. Here is more information on that aspect:

    MLA taxonomy and custom taxonomy archive pages

    Regarding “where to apply shortcode, and how to read/parse it“, that’s the PHP code I referred to in my first response. If you have decided that taxonomies will work for you I can give you more specific guidance on this second step of your application development. Let me know what you think.

    Thread Starter direys

    (@direys)

    Thanks for the links and the information about taxonomies. I think defining some new taxonomies is definitely the way I want to go. I’m happy to learn to use PHP, if that’s what’s required to make this happen – most plugins I find are for use on posts, not media items. The first article showed some PHP and I think I can read it fairly well, I just don’t know exactly what functions I’d have access to or would want to call. And I still have no idea where I would insert that code. What are you willing to teach me? ??

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update. I am traveling for a few days and away from my development/test system. I will work on this when I return and post an update here when I have progress to report.

    Thanks for your patience and understanding.

    Thread Starter direys

    (@direys)

    I look forward to it! Thanks – have fun!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your patience in awaiting further progress. As you can see from the Support Forum list I am trying to catch up on a number of topics started during and after my travels.

    Going back to your first post, you wrote:

    I want to display all “portfolio” category photos in a thumbnail list, with search options on the side to filter by “Species,” “Room,” and “Finish.” Each filter would be a checklist of Custom Field Values for that Custom Field Name, and would limit the display of photos to those that match all filter parameters.

    In your most recent post you added “I think defining some new taxonomies is definitely the way I want to go.” I’d like to know a bit more about the three taxonomies you have in mind:

    1. How many terms will be used in each taxonomy; a few, a dozen, hundreds?
    2. For each taxonomy, is it hierarchical or flat? In other words, are there parent child relationships such as Species = Kingdom/Phylum/Class/Order/Family?
    3. Can you give me a few example terms in each taxonomy?

    I believe your application will require a bit of PHP code to parse out the search options and compose the appropriate database query to filter the gallery display. The easiest way to add this to the site is a small custom plugin along the lines of the many example plugins in the /media-library-assistant/examples directory. That would also be a convenient place to put the code required to define the new taxonomies. I will work on that.

    This project may require a few iterations and it would be easier to continue the dialog by email, then post a summary of the results here when we’re done. If you give me your contact information I can reply with an email address where you can send more information and other materials. You can use the Contact Us page at our web site:

    Fair Trade Judaica/Contact Us

    Do not post your e-mail address in the forum; personal details in a public forum violates WordPress guidelines. If you have trouble accessing the FTJ site, post a note here with your country of origin and I can temporarily unblock it. I look forward to hearing from you.

    Thread Starter direys

    (@direys)

    I will contact you through your website and we can continue discussion through private email. Thanks for your help ??

    Plugin Author David Lingren

    (@dglingren)

    Thank you for working with me offline to develop the first cut at a solution for your application. I know there’s more to be done but I want to summarize the current status so others can benefit from the progress we’ve made.

    The current MLA Development Version dated 20160527 implements a new shortcode, [mla_term_list], that generates the terms checklist you need for your application. Building on that enhancement I have created a new example plugin, /media-library-assistant/examples/mla-custom-taxonomy-example.php.txt that defines three custom taxonomies (Species, Rooms and Finishes) for your application and uses the hooks provided by the shortcode to implement that filtering your application requires. Once the example plugin is installed and activated you can use a standard WordPress page to implement a filtered, paginated gallery display. Here is the complete source text for the page:

    <style type='text/css'>
    .entry-content ul.term-list-checklist {
         list-style: none;
    }
    </style>
    <table><tr>
    <td>
    <form id="mla-filter-form" action="." method="post" class="row">
    Species:
    [mla_term_list taxonomy=species mla_item_parameter=current_species mla_output=checklist hierarchical=true show_count=true pad_counts=true use_filters=true ]
    Rooms:
    [mla_term_list taxonomy=room mla_item_parameter=current_rooms mla_output=checklist show_count=true use_filters=true ]
    Finishes:
    [mla_term_list taxonomy=finish mla_item_parameter=current_finishes mla_output=checklist show_count=true use_filters=true ]
    Items per page: [mcte_per_page numberposts=1]
    
    <input id="submit" name="submit" type="submit" value="Filter" />
    </form>
    </td>
    <td>
    [mla_gallery attachment_category=America columns=1 numberposts=1 add_filters_to=attachment_category mla_output="paginate_links,prev_next"]
    [mla_gallery attachment_category=America columns=1 numberposts=1 add_filters_to=attachment_category mla_nolink_text="No items match the current filter selections."]
    </td>
    </tr></table>

    Of course, the three custom taxonomies must also be included in MLA taxonomy support. After the example pluin is installed you will see three new taxonomies in the Settings/Media Library Assistant General tab. Check the Support and Inline Edit boxes to add these taxonomies to the MLA screens. You can use the Media/Assistant Bulk Edit and Quick Edit areas to assign terms to your images.

    To get the Development Version, follow the instructions in this earlier topic:

    Shortcode not working in (special) widget

    I look forward to working with you to refine the solution and completing your application design. Thanks for your help with this great example of how to use the new [mla_term_list] shortcode.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.30, which contains the [mla_term_list] shortcode and the ‘mla-custom-taxonomy-example.php.txt’ example plugin.

    I am marking this topic resolved, I will continue to work with you offline to refine the solution. I will post a summary of any further progress to this topic.

    Plugin Author David Lingren

    (@dglingren)

    I have updated the example plugins required for this application, splitting the custom taxonomy part from the custom shortcodes that generate the user interface elements. The /media-library-assistant/examples/mla-custom-taxonomy-example.php.txt example plugin now does one thing; generates the custom taxonomies. The new mla-ui-elements-example.php.txt example plugin implements the custom shortcodes and filters. The shortcodes have been changed from [mcte_ ... ] to [muie_ ... ] and some additional features have been added.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How do I provide a front-end search of my media items using Custom Fields?’ is closed to new replies.