Support » Plugin: Media Library Assistant » post parent, link images

  • Resolved ellabtz

    (@ellabtz)


    Hi David,
    First of all thank you for this great plugin! 🙂

    I would like to insert a gallery on my website filtered by categories, that works great thanks to your plugin!
    But in addition to that I would like to have the option that as soon as you click on one of the images, you are automatically redirected to the page or the post where this image is used.
    Now i found a shortcode that at least redirects me to the parent page:

    [mla_gallery attachment_category=’test’ mla_link_href='{+site_url+}/?page_id={+parent+}’]

    Unfortunately I noticed that almost all of my images are not yet assigned to a parent .. is there a way to automatically fill out the parent field? Or is there any other shortcode I can use for redirecting me to the respective page ?

    Would be very grateful for your help!
    Regards, Elena

    The page I need help with: [log in to see the link]

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

    (@dglingren)

    Thanks for the positive feedback and for the work you’ve done to find a solution for your application.

    You asked “is there a way to automatically fill out the parent field?” Yes, you can use one of MLA’s example plugins to accomplish this task.

    Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “fixit” in the text box and click “Search Plugins” to filter the table.

    You are looking for the “MLA Insert Fixit” 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.18, installed.

    Once the example plugin is activated you can go to the Tools admin menu and click on “Insert Fixit”. Scroll down to the “Attach Media Library items” section and use the tools there to attach your items.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding the example plugin or the above suggestions. Thanks for your interest in the plugin.

    Thread Starter ellabtz

    (@ellabtz)

    Hi David,
    Thank you very much for the quick reply!!

    I just installed and tested the plugin “MLA Insert Fix”, unfortunately the function “Attach Media Library items – Attach Inserted in” does not work for me. “Attach Featured in” works fine, all featured images now have the right parent.

    The problem is that i have a total of about 5000 images embedded on my site, the 300 featured images are fine, but I also need a parent for the other images.
    Important to say is that almost all my images are included via a masonry gallery, I use the theme Enfold Child.

    Is there the possibility to read the parent from masonrys or do I have to use another plugin for this?
    my website: https://www.reisebuero-bamberg.de/

    Thank you in advance! 🙂

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news on your progress and the additional information about your application.

    The current MLA version does not contain any features that would enable you to “attach” items based on their use in a “masonry gallery” or gallery-generating shortcode. I do not know of any other plugin that would do this either. Is the “masonry gallery” part of the theme or some other plugin?

    Solving this problem in a general way that works for many applications, themes and plugins would be difficult and beyond the time and effort I can devote to it. If I had access to the theme or plugin I might be able to work out a specific solution. As I wrote elsewhere, I cannot afford to purchase themes or plugins for this purpose, but I have had good luck in the past working the authors to get a courtesy copy to use for my testing. You could check with the theme/plugin support team to see if this is possibility.

    Thread Starter ellabtz

    (@ellabtz)

    The ‘Masonry gallery’ is part of my Theme Enfold.
    I will contact the Enfold Support. When I have found a suitable solution, I will share it here!
    Thanks you!

    Thread Starter ellabtz

    (@ellabtz)

    Hi David,
    I contacted the Enfold Support and they told me this:
    „The wp_get_attachment_link function might help. https://developer.wordpress.org/reference/functions/wp_get_attachment_link/
    Unfortunately he couldn‘t tell me where I have to implement this code, could you help me further?
    Thank you!

    • This reply was modified 4 months, 1 week ago by ellabtz.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to contact the Enfold support team and for posting their reply. It looks like they have not understood your question/requirements.

    The wp_get_attachment_link() function returns a hyperlink that contains the item thumbnail image and links to the “Media Page” for the item. MLA uses it for the link=page parameter. This function has nothing at all to do with finding the items that participate in a masonry gallery and attaching them to their parent post/page.

    What you want is a solution that:

    1. Finds all the masonry gallery shortcodes in the site,
    2. Executes each shortcode to find the items it returns, and
    3. Attaches each item to the post/page containing the shortcode.

    The above will work for galleries that are dynamic, e.g., display items having a particular taxonomy term. If the gallery items are fixed, i.e., the item ID values are stored somewhere the solution would be to find the ID values and then attach the items.

    Either solution requires more information about the Enfold masonry gallery than I have. I would be happy to work with the Enfold people if they want to contact me at my web site.

    I regret the confusion but I will help if I can.

    Thread Starter ellabtz

    (@ellabtz)

    Thank you for your update! I really appreciate your help!! 🙂

    I have contacted the Enfold support again, told them the issue and asked them to contact you for information about the masonry gallery.
    Please let me know if no one gets back to you!

    Thread Starter ellabtz

    (@ellabtz)

    Hi David,

    I got some new information from the Enfold Support.

    „If you want to extract the ids of the images from a masonry element, you can parse the shortcode and get the value of ids parameter. This is an example of masonry shortcode.

    [av_masonry_gallery ids='357,356,355,354,353' caption_elements='title excerpt' caption_styling='' caption_display='always' size='flex' orientation='' gap='large' columns='flexible' av-medium-columns='' av-small-columns='' av-mini-columns='' items='24' paginate='none' color='' custom_bg='' overlay_fx='active' animation='active' container_links='active' link_dest='' lightbox_text='' lazy_loading='disabled' id='' custom_class='' template_class='' av_uid='av-kq1y46dy' sc_version='1.0']“

    Is this helpful for you?
    Best regards

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the information from Enfold Support and the example of a masonry gallery shortcode. As they suggested, it should be possible to parse the ids= values and use the values to attach the items to the post/page in which the shortcode appears.

    I will investigate the work required to add something to the MLA Insert Fixit example plugin and post an update here when I have progress to report.

    Thanks for your help with this and for your patience.

    Plugin Author David Lingren

    (@dglingren)

    I have gone back over the code in the “MLA Insert Fixit” example plugin and I believe the current version contains a tool which should work for your masonry gallery shortcodes.

    Once the example plugin is activated, go to the Tools admin menu and click on “Insert Fixit”. Scroll down to the “Attach Media Library items” section and use the “Attach Referenced in” tool to attach your items. This tool looks for the ids= parameter(s) in post/page content and attaches the items it finds in the list(s).

    It would be great if you give that tool a try and let me know if it works for you. If not, I will investigate further. Thanks!

    Thread Starter ellabtz

    (@ellabtz)

    Thank you so so much for your help, David!!

    I used the “Attach Referenced in” tool, but unfortunately I get this message:
    Results:
    Attach Referenced Items processed 0 posts/page references to 0 unattached items and updated 0 items. There were 0 error(s).

    My Insert Fixit Plugin is Version 1.18, is that the right one?
    Thank you so much! 🙂

    Plugin Author David Lingren

    (@dglingren)

    Thanks for giving the “Attach Referenced in” tool a try. I regret that it did not work as I hoped.

    On further investigation I found that the current version of the tool only looks for the ids= parameter in the [gallery] and [mla_gallery] shortcodes. I have developed a new version of the plugin that enhances this tool.

    I have uploaded a new MLA Development Version dated 20210625 that contains v1.19 of the example plugin. You can find step-by-step instructions for using the Development Version in this support topic:

    PHP Warning on media upload with Polylang

    Once the Development Version is installed you must update the example plugin. Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “fixit” in the text box and click “Search Plugins” to filter the table.

    You are looking for the “MLA Insert Fixit” example plugin. Find that plugin and hover over the title in the left-most column. Click the “Update” 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.19, installed.

    Once the example plugin is activated, go to the Tools admin menu and click on “Insert Fixit”. Scroll down to the “Attach Media Library items” section and replace the default “gallery,mla_gallery” shortcodes with “av_masonry_gallery”. Then, use the “Attach Referenced in” tool to attach your items.

    It would be great if you could install the Development Version, update the example plugin and let me know if it works for you. Thanks again for your patience and for inspiring this new MLA Insert Fixit feature.

    Thread Starter ellabtz

    (@ellabtz)

    I installed the Development Version and updated the plugin, that worked perfect. But unfortunately only 251 images were found by clicking on the “Attach Referenced in” tool. Do you know what the reason is? There are still about 4000 images missing.

    Results:
    Attach Referenced Items skipped 34 attached items, processed 254 posts/page references to 251 unattached items and updated 251 items. There were 0 error(s).

    Thanks for your time!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to update your system and run the enhanced tool.

    The only way to make progress on the remaining unattached items is to find one or more of the posts/pages that contain them and posting the content so I can see how they are referenced and why they are not processed. You can post an update here or contact me at my web site if you’d like to continue the work by email. Let me know how you would like to proceed.

    Thread Starter ellabtz

    (@ellabtz)

    Just wrote you an email! Thank you so much.

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.