• Resolved Ernest

    (@ersaloz)


    Well, first thing first, thanks for this great extension.

    And now for the issue. In a site I contribute to, when there are several images for an entry, I use to set a 1×1 paginated gallery with all of them. That works great when displaying the entry in its own page.

    But in latest-entries (aka blog layout pages) there is an annoying behavior. If two of these entries with mla_gallery drop in the same blog page, when paging through one of the galleries, the other gallery gets blank.

    Here is an example (as long as nobody adds entries to the category):

    http://www.cellit.es/category/actividad-cultural/exposiciones/

    (oh yes, at present the first gallery selects only one image, so paginate the bottom one).

    Really I am new to MLA and a little overwhelmed with all these features, so don’t know if maybe I could avoid this with some fine-tuning. For the sake of completeness, I will add some detail:

    WP v4.6.1
    MLA v2.33

    1st mla_gallery definition:

    [mla_gallery]
      tag=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      post_parent=current
      posts_per_page=1
      mla_markup=cool
      mla_style=cool-left
      size=large
    [/mla_gallery]
    [mla_gallery]
      tag=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      post_parent=current
      posts_per_page=1
      mla_output='paginate_links,prev_next'
      mla_prev_text='◁'
      mla_next_text='▷'
    [/mla_gallery]

    2nd mla_gallery definition:

    [mla_gallery]
      tag=cuadernos-de-viaje-la-litera
      posts_per_page=1
      mla_markup=cool
      mla_style=cool-left
      size=medium
    [/mla_gallery]
    [mla_gallery]
      tag=cuadernos-de-viaje-la-litera
      posts_per_page=1
      mla_output='paginate_links,prev_next'
      mla_prev_text='◁'
      mla_next_text='▷'
    [/mla_gallery]

    mla_markup ‘cool’ defaults:
    columns=1 mla_caption='{+title+}' link=full mla_link_attributes='target="_blank"'

    Of course, I would gladly provide more info if needed,

    Thanks in advance.

    • This topic was modified 9 years, 8 months ago by Ernest.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question, the link to your site and the details of your shortcodes; very helpful. Thanks as well for your MLA review; I agree that the complexity of the shortcodes can be “rather techy”. They have grown quite a bit over the years as MLA users posed application questions and suggestions for enhancement.

    The answer to your problem is a good example. It has come up before in these earlier topics:

    Pagination pages all galleries displayed on page

    Pagination

    The older “Pagination” topic was the inspiration for a new [mla_gallery] parameter:

    mla_page_parameter – the name of the parameter containing the current page number; default “mla_paginate_current”. You can change the name if you need multiple paginated galleries on one post/page. If you use this parameter, make sure you add it to the gallery shortcode and all pagination shortcodes for that gallery, and use the same unique value in all shortcodes for the specific gallery.

    For your application I suggest you use the tag slug or your mla_page_parameter values, e.g.:

    
    [mla_gallery]
      tag=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      post_parent=current
      posts_per_page=1
      mla_page_parameter=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      mla_markup=cool
      mla_style=cool-left
      size=large
    [/mla_gallery]
    [mla_gallery]
      tag=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      post_parent=current
      posts_per_page=1
      mla_page_parameter=recuerdos-del-ayer-la-litera-en-blanco-y-negro
      mla_output='paginate_links,prev_next'
      mla_prev_text='◁'
      mla_next_text='▷'
    [/mla_gallery]
    

    and

    
    [mla_gallery]
      tag=cuadernos-de-viaje-la-litera
      posts_per_page=1
      mla_page_parameter=cuadernos-de-viaje-la-litera
      mla_markup=cool
      mla_style=cool-left
      size=medium
    [/mla_gallery]
    [mla_gallery]
      tag=cuadernos-de-viaje-la-litera
      posts_per_page=1
      mla_page_parameter=cuadernos-de-viaje-la-litera
      mla_output='paginate_links,prev_next'
      mla_prev_text='◁'
      mla_next_text='▷'
    [/mla_gallery]
    

    That seems to be the easiest way to guarantee a unique pagination name for each gallery no matter how many appear on the same page.

    I hope that gives you the results you are seeking. I am marking this topic resolved, but please update it if you have any problems or further questions regarding multi-gallery pagination. Thanks for your interest in the plugin.

    Thread Starter Ernest

    (@ersaloz)

    Thank you; this works, so certainly the issue is solved. But I stumbled upon a fresh question, IMO related to the topic, so will go on here.

    I was trying to find a ‘standard’ way of specifying the mla_page_parameter, to save effort and typos. By our posting habits, two galleries with same tag could occur in the same HTML page, but never two galleries in the same entry. So I thought page_ID could be a good discriminator.

    To my surprise, ‘p-{+page_ID+}’ does not work as value for mla_page_parameter, while ‘p-867’, ‘p-981’, etc., do.

    As far as I can see, the values of mla_page_parameter, also in pagination shortcodes, are the same either way, but the former does not paginate while the latter does. What’s the difference.

    Sorry if I am missing something again!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news.

    You wrote “To my surprise, ‘p-{+page_ID+}’ does not work as value for mla_page_parameter …“. That is correct. The mla_page_parameter is a simple, literal, value. It does not pass through the parameter expansion logic that would replace things like {+page_ID+}. I will see if there is a way to improve that, but the order and timing of when everything is processed can be tricky.

    You wrote “As far as I can see, the values of mla_page_parameter, also in pagination shortcodes, are the same either way …“. I am not exactly sure what you mean, but here is a possible answer. Your example has two pairs of [mla_gallery] shortcodes. In each pair, one shortcode (the first) displays the gallery and the other (second) displays the pagination controls. These two shortcodes must agree on what the current page is, so they need to have the same value for mla_page_parameter. Does that answer your question?

    Thread Starter Ernest

    (@ersaloz)

    I am not exactly sure what you mean, but here is a possible answer. Your example has two pairs of [mla_gallery] shortcodes. In each pair, one shortcode (the first) displays the gallery and the other (second) displays the pagination controls. These two shortcodes must agree on what the current page is, so they need to have the same value for mla_page_parameter.

    Yes, that’s understood.

    I meant: suppose a gallery is in a post with e.g. ID 971; I set either mla_page_parameter='p‑{+page_ID+}' or mla_page_parameter='p‑971'. If I then examine the value of mla_page_parameter thru say mla_rollover_text='{+mla_page_parameter+}', I see both as p‑971.

    Plugin Author David Lingren

    (@dglingren)

    Ah, that makes sense; thanks for clarifying.

    When you set the mla_rollover_text, it becomes part of the template evaluation process that generates the gallery display. The results are correct because there is a two-step evaluation that happens as the gallery is generated:

    1. The mla_rollover_text is set to the value of mla_page_parameter, which is p-{+page_ID+}
    2. The {+page_ID+} is expanded to be p-971 as part of evaluating the markup template to generate the HTML for the gallery display.

    It works because the mla_rollover_text is part of the template process. In the current MLA version the use of mla_page_parameter to find the “current page” for pagination purposes happens outside the template process and so {+page_ID+} does not get processed/expanded. I will look at changing that in the next MLA version.

    Thread Starter Ernest

    (@ersaloz)

    Aha! Understanding is beautiful. Thank you very much.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20160930 that contains the mla_page_parameter enhancement. To get the Development Version, follow the instructions in this earlier topic:

    Shortcode not working in (special) widget

    With the new version you can use any of the “page-level” substitution parameters, e.g., your mla_page_parameter="p-{+page_ID+}" example. It would be great if you can install the Development Version and let me know if it works for you.

    Thanks for inspiring this MLA enhancement.

    Thread Starter Ernest

    (@ersaloz)

    A goog new and a bad one.

    The good new: indeed pagination works with substitution parameters. I set up an scenario as complex as I could, and it worked flawlessly.

    The bad new: in practice, this is worthy only for galleries at the top of the page, as every gallery pagination refreshes the whole page and you lose sight of any gallery below the viewport height. This may be an issue of my theme; it is quirky also with readmore, comments and so on. A pity.

    And this one has nothing to do with what we were dealing with, but I also enjoyed the new layout of the Shortcodes tab, and noticed a strange bug: if I add a description to my custom styles / markups, some store it right, but at least one (well, there are three in total) blanks the ‘Description’ field and adds a comment like:

    <!-- mla_description="My description, whatever..." -->

    at the start of the next field.

    Thank you very much.

    • This reply was modified 9 years, 7 months ago by Ernest.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to install and test the new Development Version. I am happy that the new mla_page_parameter is working for you.

    You wrote “every gallery pagination refreshes the whole page …“. That is true, and is a limitation of the [mla_gallery] shortcode processing. To refresh just the content of one gallery on a multi-gallery page (or any other pagination-related refresh) would require a substantial development effort to add Ajax support to the shortcode. I have not found the time required to put the effort in to that development task.

    Thank you for your comments on the new Shortcodes tab implementation; it replaces one of the earliest parts of the plugin that has long been due for improvement. The mla_description comment is used because earlier MLA versions did not support a separate Description section and I wanted to preserve the ability to go back to an earlier MLA version after updating to the latest version.

    The comment is created when a style template is stored and is supposed to be separated out and removed when the template is re-loaded later. If that’s not happening for you it is a defect I want to fix. I haven’t been able to recreate it on my system. Is there anything else you can tell me about the steps you took that makes it happen for you? Does it always happen to all your style templates or is it intermittent? Any additional details you can provide would be very helpful; thank you!

    Thread Starter Ernest

    (@ersaloz)

    Is there anything else you can tell me about the steps you took that makes it happen for you?

    Not really. It happened with only one style template, second in listing order. As I changed template names to test if this was related to position in list, the problem vanished, and I haven’t been able to reproduce it again, not even recreating the original template names.

    Thank you for your patience and kindness.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to go back and test out the “Description” issue. I am not entirely surprised that the problem corrected itself when you renamed the template, since the mla_description comment is re-processed every time the template is saved or loaded.

    If it happens again, let me know.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘mla_gallery blog layout issue’ is closed to new replies.