• Resolved redeclipse

    (@redeclipse)


    Hello again David, I was wondering if it was possible for the thumbnail within the gallery to be linked to the parent instead of the file itself. Sorry I am not good at this, but “link=file” and “link=none” are the only two options I know. Is there a link=”parent” of some sort?

    Working on THIS PAGE HERE.

    This is what I currently have.

    <div style="clear: both; float: left">
    [mla_gallery my_custom_sql='attachment_category=desktop' posts_per_page=40 mla_output="previous_page,wrap" mla_link_text='&larr; LAST PAGE' mla_rollover_text="Previous/Last Page"]
    </div>
    
    <div style="float: right">
    [mla_gallery my_custom_sql='attachment_category=desktop' posts_per_page=40 mla_output="next_page,wrap" mla_link_text='NEXT PAGE &rarr;' mla_rollover_text="Next Page"]
    </div>
    
    <div style="clear:both; margin-top:0px; margin-bottom:20px;"></div>
    
    <p style="font-size:.5em">
    [mla_gallery my_custom_sql='attachment_category=desktop orderby=id order=DESC' link=none size=medium columns=4 mla_caption="<a href='https://www.theforgottenlair.net/wallpapers/?page_id={+parent+}'>{+parent_title+}</a>" numberposts=40]
    </p>
    
    <div style="clear: both; float: left">
    [mla_gallery my_custom_sql='attachment_category=desktop' posts_per_page=40 mla_output="previous_page,wrap" mla_link_text='&larr; LAST PAGE' mla_rollover_text="Previous/Last Page"]
    </div>
    
    <div style="float: right">
    [mla_gallery my_custom_sql='attachment_category=desktop' posts_per_page=40 mla_output="next_page,wrap" mla_link_text='NEXT PAGE &rarr;' mla_rollover_text="Next Page"]
    </div>

    I am currently in the process of creating a new category for the mla gallery, as this will be the second gallery I have on this site.

    • This topic was modified 8 years, 2 months ago by redeclipse.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter redeclipse

    (@redeclipse)

    Also on a separate note, is there a way to orderby a custom value? I’d usually have it by upload date/ID, however there were some mix ups and but the right order is still important for me to show my oldest works last. (I had decided to make bigger thumbnails for everything much later, thus putting a lot of them out of order.)

    Thank you!

    Plugin Author David Lingren

    (@dglingren)

    Always good to hear from you, and thanks for your questions. Thanks as well for posting the complete text of what you currently have; very helpful. You are already close to a solution for the first question regarding thumbnail links.

    Your current shortcode already has the desired parent page link:

    
    mla_caption="<a href='https://www.theforgottenlair.net/wallpapers/?page_id={+parent+}'>{+parent_title+}</a>"
    

    You can simplify this somewhat to:

    
    mla_caption="<a href='{+site_url+}?page_id={+parent+}'>{+parent_title+}</a>"
    

    MLA provides a parameter to change the destination of the link behind each item thumbnail; mla_link_href. For your application you can remove the link=none parameter and substitute:

    
    mla_link_href="{+site_url+}?page_id={+parent+}"
    

    With that change, both of the links will go to the right destination.

    Regarding your second question, MLA supports sorting the gallery display by the value of any WordPress custom field. Sorting on a custom field value has special syntax. Here’s what the “Order, Orderby” section of the Settings/Media library Assistant Documentation states:

    <keyname>, meta_value, meta_value_num – Order by custom field value. Note that a meta_key=keyname must also be present in the query. For example, to sort by a custom field called “Publication Date” and display the most recent items first, code [mla_gallery meta_key=”Publication Date” orderby=meta_value order=DESC]

    However, you are using an MLA example plugin, “MLA tax query Example”, to increase the performance on your site. The current version of the example plugin supports many orderby choices but not, sadly, the meta_value choice. This is because custom field values are stored in a separate database table and sorting by them requires joining two database tables. If you application requires this I can investigate the work required to implement it, but I do not know what the performance impact will be. Let me know if you’d like me to look into it.

    By the way, whatever orderby parameters you use should be the same in all of the shortcodes on your page. You have one in the [mla_gallery] that displays the images but you must add them to the shortcodes for pagination as well.

    I hope that gets you closer to a solution. Let me know about the custom field sorting.

    Thread Starter redeclipse

    (@redeclipse)

    Ah so what you’re saying right now is that there is no fast way to quickly sort based on a custom field of some sort… Hmm, I’m not that familiar with databases and such so I wouldn’t want to bother you if it’s not something I could simply add a line of code to. I guess the only option I have is to manually reupload every image again in the correct order, for the sole purpose of being the thumbnail to this section of the site. That way the pagination would work as well. It’s a hassle, but I’ve done worse! ??

    Thank you so much again!

    Plugin Author David Lingren

    (@dglingren)

    Well, what I said was that I don’t know if sorting on the custom field would be fast or not; I don’t know for certain that it wouldn’t be fast enough. Manually reloading the images sounds pretty painful, and it’s worth exploring alternatives. For example, one of the choices already supported is “menu_order”. If you create a custom field with a numeric value ( 1,2,3, etc.) that contains the order you want it would be straightforward to generate the appropriate menu_order values for sorting purposes.

    What kind of values were you thinking of for the custom field? Is there a value in the image files IPTC/EXIF/XMP metadata you can use? If so, a solution is not far away.

    Can you give me a sample of ten or so images in the wrong order and tell me the right order?

    Let me know if you’d like to pursue a solution.

    • This reply was modified 8 years, 2 months ago by David Lingren.
    Thread Starter redeclipse

    (@redeclipse)

    Ah, perhaps the menu order is what I wanted. For future reference, how would I input the menu_order in the line of code?

    But I’ve already gone through the process of uploading the entire gallery’s image, so everything’s fixed now. I’m now implementing it on another section/gallery as well. ?? Thank you once again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Link To Parent Post’ is closed to new replies.