• Resolved Harm10

    (@harm10)


    Would it be possible to include a hash part to the pagination links?
    I see that the gallery gets an unique id so that could easily be added to the generated link.

    Suppose you have a lot of text and a gallery below it.
    Every time the visitor pages this gallery the web page is positioned at the top again…………….
    This is even more a problem on the main page of your blog whenever you have more posts that contain a gallery with pagination.

    <div id="mla_gallery-1" class="gallery galleryid-1836 gallery-columns-3 gallery-size-thumbnail">

    So in stead of generating links like
    https://myurl.com/?p=1836&mla_paginate_current=2
    links like this
    https://myurl.com/?p=1836&mla_paginate_current=2#mla_gallery-1
    would be better I think.

    BTW If you think I am asking too much questions please say so!

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

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

    (@dglingren)

    Thanks for another interesting question – there is no such thing as “too many”; I always learn something and frequently get new ideas for MLA features.

    You can add gallery-specific links and anchors to your application by making two changes:

    1. Define a custom markup template that adds an HTML anchor tag (<a name='[+selector+]'>) to the beginning of the “Open” section, e.g.,
      <a name='[+selector+]'>
      <div id='[+selector+]' class='gallery galleryid-[+id+] gallery-columns-[+columns+] gallery-size-[+size_class+]'>

      You can find more information on creating custom templates in the Documentation tab.

    2. Add the anchor reference to your pagination [mla_gallery] shortcodes, e.g.,
      mla_link_href="{+new_url+}#mla_gallery-1"

      You’ll have to modify the “mla_gallery-1” portion to reference the gallery you want.

    There’s a little MLA bug that adds an extra parameter to the links, but it doesn’t seem to affect the outcome. I will correct it in my next MLA version.

    Don’t forget to add the custom template parameter to your “gallery display” [mla_gallery] shortcodes. Here is an updated version of the “two paginated galleries” example showing the shortcode modifications:

    [mla_gallery attachment_category=admin posts_per_page=2 mla_markup=anchor]
    
    Go to page: [mla_gallery attachment_category=admin posts_per_page=2 mla_output="paginate_links,show_all" mla_link_href="{+new_url+}#mla_gallery-1"]
    
    ----------
    
    [mla_gallery attachment_category=teachers posts_per_page=1 mla_page_parameter="mla_paginate_current_2" mla_markup=anchor]
    
    Go to page: [mla_gallery attachment_category=teachers posts_per_page=1  mla_output="paginate_links,show_all" mla_page_parameter="mla_paginate_current_2" mla_link_href="{+new_url+}#mla_gallery-3"]

    You can see that the two “gallery” shortcodes are mla_gallery-1 and mla_gallery-3, and that my custom markup template is called “anchor”.

    I am marking this topic resolved, but please update it if you have any problems with the above suggestions or you need more specific help on creating a custom markup template.

    Thread Starter Harm10

    (@harm10)

    Although it works I think this is a somewhat complicated way to get a hash behind your paging links…….

    Wouldn’t an approach like adding a new mla_output parameter for this be easier?
    Something along the way of
    mla_output=”hash(‘mygallery’)”
    to put in the gallery shortcode itself and
    mla_output=”paginate_links,prev_next,hash(‘mygallery’)”
    to add to the paging gallery shortcode ?

    BTW I also asked in one of my other replies on resolved issues: do you have a wish list for additional features?

    Plugin Author David Lingren

    (@dglingren)

    Thank you for confirming that the solution, although somewhat complicated, will work. I have, by the way, fixed the small bug that added the extra parameter to the links.

    Every time I get a question such as this I try to evaluate whether it should be added to the plugin or solved with an application of the tools/features already I the plugin. As you know, MLA is already complex, and adding (and documenting) more parameters and options must be weighed against adding to that complexity.

    Yes, I do have a “wish list” and at this point most of the items on it come from support topics and user experience. That is one of the reasons I spend so much time answering support questions and working through examples and application ideas with MLA users. This kind of feedback is a big motivation for continuing to work on MLA. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination link including hash part?’ is closed to new replies.