Working with shortcode libraries
-
Hey this is a great addon.
I’m having a fairly simple issue I think, but I’ve spent a few hours on it to no avail.I’m currently displaying a library like this with the correct taxonomy.
[mla_gallery attachment_tag="Pen Swap" posts_per_page=12 mla_alt_shortcode=su_custom_gallery link="lightbox"]But I’m trying to merge this with the display style/output of something like this:
[su_custom_gallery source="posts: recent" limit="40" link="lightbox"]I basically just keep getting Custom Gallery: images not found
thank you for your support!
-
I should add the the mla_alt-shortcode tags and link tags in the first code segment aren’t working
Thanks for your question and for including the details on your shortcodes; very helpful.
You do not say what theme or plugin you are using for the
[su_custom_gallery]shortcode so I can’t investigate further to see what parameters the[su_custom_gallery]supports. if it’s a free theme/plugin I can try installing it on my own system. If not, can you point me to more documentation on it?The
mla_alt_shortcode=su_custom_galleryessentially breaks the gallery generation process into two pieces. First, MLA uses data selection parameters such asattachment_tag="Pen Swap"andposts_per_page=12to find the items for the gallery. MLA generates a list of the item ID values, something likeids=1,2,3', and passes this to the alternate shortcode along with the other parameters such assource=”posts: recent”` for formatting the gallery display.It looks like you have two possible problems. First, your example includes
attachment_tag="Pen Swap". Theattachment_tagparameter requires the term <strong>slug</strong> value, not the term name; try something likeattachment_tag="pen-swap". Second, it looks like the[su_custom_gallery]does not accept anidsparameter with a list of items for the gallery display. It might be using thesource="posts: recent"parameter instead and not finding any items.Regarding your second post, the “tags” issue might be the name/slug confusion. The “link” issue might be that MLA is not generating the links and the
linkparameter is ignored whenmla_alt-shortcodeis present. It is up to the[su_custom_gallery]shortcode to generate whatever links or parameters are required to activate the lightbox features.I will leave this topic unresolved for now in case you have more information or problems/questions regarding the above suggestions. Thanks for your interest in the plugin.
Hey!
appreciate the quick turnaround time.
This is working fine and pulling the correct info:
[mla_gallery attachment_tag="Pen Swap"]What I’m trying to do is to use the built-in shortcode ultimate Gallery.
The Shortcode generated by default looks like this:
[su_custom_gallery source="posts: recent" limit="40" link="lightbox"]My assumption is that I need to build a new shortcode that looks something like this:
[mla_gallery mla_alt_shortcode=su_custom_gallery attachment_tag="Pen Swap" link="lightbox"]Hopefully this provides some more clarity.
Thanks for your update with the additional information.
You wrote “What I’m trying to do is to use the built-in shortcode ultimate Gallery. The
[su_custom_gallery]shortcode is not built-in to WordPress. I was able to find this plugin:It looks like this is the shortcode you are using:
Is this plugin running on your site and providing the
[su_custom_gallery]?Your assumed solution looks about right, but
[su_custom_gallery]requires a somewhat unique parameter to specify a list of item ID values, something likesource="media: 1650,1648,1649". MLA’s alternate shortcode support will not work as-is, but the problem can be solved with a small bit of custom code added to your theme or a small custom plugin. This would be a (nuch simpler) variation on the plugin created for this earlier topic:Featured Image (Post_thumbnail)
If you can confirm that the information above is correct I can investigate further.
Hey- everything above is correct.
I think that using a different support plugin for displaying a gallery would be easier though.
I think the trick would be to use one that is both shortcodes ultimate and MLA friendly? I’m trying to keep the instance fairly customization light to keep it maintainable.
Thanks for confirming my understanding of your application.
After thinking about your requirements and how to adapt them for other MLA users I decided to add a new feature to the official MLA release rather than develop a custom plugin. I have added a new parameter to the “Support for Other Gallery-generating Shortcodes”:
mla_alt_ids_template – (optional) a Content Template for the entire parameter value passed to the alternate shortcode. When processing the template, the list of ID values is available as the {+alt_ids+} substitution parameter. See the example below.
The example selects items assigned to a taxonomy term and uses the Shortcodes Ultimate plugin’s Custom gallery shortcode to display the gallery with a lightbox enhancement. The
mla_alt_ids_nameandmla_alt_ids_templateparameters change the “ids” and attachment ID defaults to the “source” and “media:” values expected by the[su_custom_gallery]shortcode:[mla_gallery attachment_tag="Pen Swap" link="lightbox" mla_alt_shortcode="su_custom_gallery" mla_alt_ids_name="source" mla_alt_ids_template="media: {+alt_ids+}"]I have uploaded a new MLA Development Version dated 20190201 that contains the new feature. You can find step-by-step instructions for using the Development Version in this earlier topic:
PHP Warning on media upload with Polylang
If you get a chance to try the Development Version please let me know how it works for you. Thanks for motivating this useful MLA enhancement.
@dglingren
Seriously.
Works like a charm out of the box. Perfect instructions 🙂Works with su_slider, su_carousel, su_shortcode.
A hundred thank you’s kind sir.
The topic ‘Working with shortcode libraries’ is closed to new replies.