• Resolved pgmdoteth

    (@pgmdoteth)


    Hi David and community

    first off, congratulation on MLA, it is a fantastic plugin. I’m a total rookie as far as web developemnt is concerned (probably build a handful of basic sites in my life, most of which using Divi).

    I have embarked on something more complex. I’m building a yacht chartering website and that entails custom taxonomies and custom post types. Case in point there is a CPT “yachts” and for each yacht post I’d like to use MLA both in header to slow a slider with a handful of media tagged as “featured” (I have creted a “featured” category and tagging as yes-although I can use att. tags better – currently trying both approaches.

    Each yacht will also feature a yacht gallery at the bottom. There is a custom media taxonomy called “media-yacht-name” to tag media with the inividual yacht name. Each post has an ACF “yacht_name” which is intended to be identical with each “page_title” (at least when the name is a single word without spaces.

    When i explicitely use the “yacht name/page title/slug” in my shortcode, MLA works like a charm and I can also filter photos with AND (so I can get only the Featured images of yacht XXX.

    [mla_gallery media-yacht-name=”XXX” AND featured=”yes”]

    The problem begins when i try to replace the explicit yacht name with a dynamic terms. I have tried yacht_name, page_title, sanitized them, fetched the slug of my custom post and so on and so forth and at best I only get MLA to fetch the images attached to the post.

    I should point out that I have some concerns on how properly my custom post types have been registered as I’m noticing some issues either with ACF/CPT UI like Divi builder not recognising them etc. Maybe it has some relation.

    Any ideas, or suggestions? I’d love any assistance you and the community can provide me with.

    Thank you for your time

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

    (@dglingren)

    Thank you for the positive MLA feedback and for your detailed application description. I can’t give you much help at this time (read note at forum top) but I have one suggestion.

    As I understand your goal, you have an ACF text field, “yacht_name”, added to your post (as a WordPress custom field) and you want to select Media Library items having a media-yacht-name term with that value; is that right?

    I regret that the current MLA version does not have any way to access custom field values of the post/page in which the [mla_gallery] shortcode appears. I will add that to my list of future enhancements, but it will be some time before I make any progress. In the interim, some post/page values are available for you to consider. You can find a complete list in the “Gallery-specific Substitution Parameters” section of the Settings/Media Library Assistant Documentation tab.

    You wrote “When i explicitly use the “yacht name/page title/slug” in my shortcode, MLA works like a charm”. You can try the page_title or, better, page_name substitution parameters. If the term slug in your media-yacht-name taxonomy matches the page_name things should work. Your shortcode would be something like:

    [mla_gallery media-yacht-name=”{+page_name+}” tax_relation=AND featured=”yes”]

    You can leave out the tax_relation=AND parameter since AND is the default value; that’s why your existing shortcode works.

    I hope that this suggestion is helpful. I will leave this topic unresolved for now – let me know if it works for you. Thanks for your interest in the plugin.

    Thread Starter pgmdoteth

    (@pgmdoteth)

    Hi David,

    thank you for getting back at me. I have tried “page_title” in the past to no avail. But I’m glad to tell you that following your recommendation ”{+page_name+}” seems to have done the trick! Thank you so much for your assistance David. I have marked the issue as resolved.

    Merry Christmas, health, joy, prosperity and thank you again so much

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20240121 that adds four new substitution parameter prefix values:

    • page_custom:
    • parent_custom:
    • page_terms:
    • parent_terms:

    You can find step-by-step instructions for using the Development Version in this earlier topic:

    How to download & install the current development version of MLA

    Once the Development Version is installed you can use the new prefix to code something like:

    media-yacht-name="{+page_custom:yacht_name+}"

    You might have to use something like {+page_custom:'yacht name‘+} depending on the ACF field label.

    The new values will be part of my next MLA version, but in the interim it would be great if you could install the Development Version and let me know if it works for you. Thanks for inspiring this MLA enhancement.

    Thread Starter pgmdoteth

    (@pgmdoteth)

    Thank you David, I will download the development version and try the new parameters out. I will let you know of any feedback I may have asap!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘MLA, custom post types and media taxonomies’ is closed to new replies.