• Resolved publicradio

    (@publicradio)


    This is somewhat related to my question about slugs, but I thought I would create a new post because it’s something a little different.

    When I create a standard gallery in WordPress, the permalinks to the attachment pages look like this: mysite.com/blogpost/attachment. In your attachment or image template, you can use previous_image_link and next_image_link to move through the images in that gallery.

    Now: the nice thing about MLA gallery is that you can create galleries that are independent of any post. You can, for example, create a gallery based on criteria like shared tags or categories.

    However, when you link to an attachment or image page this way, your previous and next links will go to the next or previous attachment in the library. If you are looking at attachment #223, the next link will be attachment #224, regardless of whether it was in the gallery to which the first image was linked.

    Ideally, the previous and next links would always cycle you through whatever gallery you were coming from. So, if you had a gallery that showed every image tagged ‘birds’, then you should click on an image, see the attachment for a bird photo, click the next link, and see the next bird in the sequence.

    Is there some kind of MLA tag that will provide this functionality? How would I do this?

    Thanks so much.

    https://wordpress.org/plugins/media-library-assistant/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter publicradio

    (@publicradio)

    You know what, your documentation clearly explains how to do this. Sorry for not reading the docs first. I’ll mark this as solved.

    Thread Starter publicradio

    (@publicradio)

    Although….

    I did follow the instructions on your site. I created a page called ‘Full Image’ and put in the short code to display one image, and the previous/next links. I set the link to this page to output this:

    mysite.com/?page_id=426&current_id=130&tag=winter

    This comes from a gallery filtered by the tag ‘winter’, which works. The result is a page with the full image on it, but no previous or next links.

    This is coming from a tag.php template that uses echo do_shortcode(‘[xxx]’) right in the php file itself. Is it possible that these instructions require the short code to be in an actual page?

    Thread Starter publicradio

    (@publicradio)

    OK, as I mentioned in the other thread, I launched the site. Here is an example of a page that uses the shortcode in your documentation. I created a page called ‘Full Image’ just to display the results. As you can see, this page will output the full image, but it will not output the previous or next links, even though they are in the page.

    For instance, the ‘next’ link is almost exactly as it is in the documentation:

    [mla_gallery mla_output="next_link" mla_link_text="Next Image →" attachment_tag="{+request:attachment_tag+}" id="{+request:current_id+}" mla_caption="{+title+}" mla_link_href="{+site_url+}?page_id=426&current_id={+attachment_ID+}&attachment_tag={+query:attachment_tag+}"]

    Plugin Author David Lingren

    (@dglingren)

    Thank you for the links to your examples and for taking the time to work through the documentation. The pagination techniques are a bit tricky, but I think you’re getting close to a solution.

    Looking at the ‘next link’ shortcode in your post I can see a couple of things to try:

    1. Change the {+site_url+}?page_id=426& portion to {+site_url+}/fullimage/?. That would agree with the URL you’ve given in the example.
    2. Change the attachment_tag references to tag, which is the query argument you use in your example. The attachment_tag argument probably isn’t generating any results, and the default is to return nothing in that case.

    You can also add something like mla_nolink_text="Nothing found" so there’s a visual indication of an empty result set, at least for debugging. You can also consider the ,wrap qualifier to prevent the next and previous links from disappearing on the last and first gallery items.

    If the above suggestions don’t resolve your issue it would be helpful to see the PHP code for your template. I will try to contact you at your site so you have an e-mail address to send more information to. Let me know how it goes.

    It’s a great site!

    Thread Starter publicradio

    (@publicradio)

    Thanks so much for your help, David. I got it to work for both tags and categories. You can see the results on the website itself. What a great plugin! Thanks again.

    Plugin Author David Lingren

    (@dglingren)

    It’s great to hear you’re making progress. Actually, your ‘cat’ example is working fine for me. I was able to navigate from ‘mosaic’ forwards to ‘meditation’ and backwards to ‘bark’ and so forth.

    There is some MLA code that fills the id parameter automatically, so it’s not surprising that you don’t need it for your application.

    I’m going to mark this topic resolved, since it seems to be working. If you’re still having trouble with the ‘cat’/categories variation, update the topic and let me know; we’ll get it worked out.

    Plugin Author David Lingren

    (@dglingren)

    Ah! Our posts crossed in the “mail”.

    Thanks for the good news and the great site. It’s always inspiring to see where MLA is getting used.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Lateral navigation’ is closed to new replies.