• Resolved cconstantine

    (@cconstantine)


    context…

    I recently worked through installing a dev version of this plugin, and it dropped/cleared my custom template. (I wasn’t aware this would happen — instructions said configuration wouldn’t be lost — or I would have manually copied out my template. It’s been over a year since I figured that part out, and I’ve no idea how I did it. *frustration* ) So, trying to configure a template for use in a

    [mla_gallery mla_markup="craigs-template" ...

    goal…

    My specific goal is to change the link on the images in the gallery (from linking to the attachment page, to linking to the post page to which the image is attached) and changing the caption from “<caption>” to something else like “<caption>, from <linked-parent-post-title>”.

    so far…

    I’ve gone into the “Shortcodes” tab under the MLA settings, and created a new template named “craigs-template” and I’ve given it a Description (since it won’t save if everything is empty).

    I’ve added mla_markup="craigs-template" to the [mla_gallery ... shortcode.

    The display of my gallery has not changed. So I’m assuming it’s using the default values for all the template items, since I left them all blank.

    It’s generates a <dl> list for each item (aka image) in my displayed gallery. It uses <dt> and <dd> for the image and meta information (below the image), respectively.

    So I’m trying to figure out how to change this part of each image’s display…

    	<dt class='gallery-icon landscape'>
    		<a href="https://constantine.name/notre-dame-de-paris/img_2193/" data-slb-active="1" data-slb-asset="1347297058" data-slb-internal="10684" data-slb-group="8886"><img aria-describedby="mla_gallery-1-10684" width="300" height="225" src="https://constantine.name/wp-content/uploads/2016/09/IMG_2193-300x225.jpg" class="attachment-medium size-medium" alt="Sunrise" srcset="https://constantine.name/wp-content/uploads/2016/09/IMG_2193-300x225.jpg 300w, https://constantine.name/wp-content/uploads/2016/09/IMG_2193.jpg 667w" sizes="(max-width: 300px) 100vw, 300px" /></a>
    	</dt>
    	<dd class='wp-caption-text gallery-caption' id='mla_gallery-1-10684'>
    		Sunrise
    	</dd>
    

    I want to change the <a ... anchor on the image to link to the parent post’s page. And in the <dd ..., showing the meta information, I want to add “, from <linked-parent-post-title>”.

    So I thought I could hunt down the value for “Item” that is being used by the default template. But I can’t find that anywhere.

    Thoughts?

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

    (@cconstantine)

    …it’s so annoying that you cannot edit in this forum after a few minutes!

    TWEAK: I don’t want to change the link on the image itself. That’s what brings up the larger display ala a lightbox.

    I just want to change the meta information below the image (as I described above).

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your report and for the details of your goal and progress.

    First, you wrote “it dropped/cleared my custom template …“. This is alarming; there is no way that simply installing a Development Version should do that and if it did happen I want to fix it! Did you lose all of you settings or just the template? Either way, I deeply regret your inconvenience and frustration.

    At the bottom of the Settings/Media Library Assistant General tab are some “Uninstall (Delete) Plugin Settings” – did you check one or both of those boxes? Just below that is the “Export ALL Settings” button, which saves everything including custom templates to a file that can be imported later. I will be sure to add that to my install instructions in the future!

    You wrote “I’ve gone into the Shortcodes tab under the MLA settings …“. I assume the tab you encountered has the new, improved layout with the option settings down the left and the templates table on the right; is that correct? Are all the default templates showing up in the table for you? If you click the “Any Status” dropdown, select “Custom” and click “Filter” you don’t see your old custom template? (there’s always hope)

    You wrote that you “created a new template named “craigs-template” and I’ve given it a Description (since it won’t save if everything is empty).” You might find it easier to copy the “default” template to make a new template that already has everything filled in. You are right that your custom tempate isn’t being used; the curent MLA version ignores any template that has an empty “Open” section. I plan to change that in the next version because some templates only need an “Item” section.

    In any case, you wrote “So I thought I could hunt down the value for “Item” that is being used by the default template. But I can’t find that anywhere.” You should see the “default” Markup and Style templates for the Gallery shortcode in the submenu table. That’s where you will find the markup you are looking for. Sadly, I’ve just discovered a small defect in the Development Version (I’ll fix that today); the rollover actions don’t appear for default templates. To see the template, check the box in the first column, select “Copy” in the Bulk Actions dropdown and click “Apply”. Then, look for the “default-copy” custom template and click the “Edit” rollover action. You can rename the copy to something else and edit it as you need to.

    The Item section of the default template is:

    
    <[+itemtag+] class='gallery-item [+last_in_row+]'>
    	<[+icontag+] class='gallery-icon [+orientation+]'>
    		[+link+]
    	</[+icontag+]>
    	[+captiontag_content+]
    </[+itemtag+]>
    
    

    It is modeled after the WordPress [gallery] markup, where [+itemtag+] is dl and [+icontag+] is dt. The dd portion is in the [+captiontag_content+], which was created to handle some WordPress 4.1 changes. Before 4.1 WordPress generated the dd tag even if the caption was empty; in 4.1 and later WordPress eliminates the entire dd part for empty captions. Since there’s no “if statement” in the MLA template language I created [+captiontag_content+] as a compromise.

    You can replace [+captiontag_content+] with the markup you need for your application. The default value when a caption is present is equivalent to:

    
    <[+captiontag+] class='wp-caption-text gallery-caption' id="[+selector+]-[+attachment_ID+]">
    	[+caption+]
    </[+captiontag+]>
    
    

    You want to add the title of the parent post/page. All of the values you need are in the “Gallery-specific Substitution Parameters” section of the Settings/Media Library Assistant Documentation tab. You can try something like:

    
    <[+captiontag+] class='wp-caption-text gallery-caption' id="[+selector+]-[+attachment_ID+]">
    	[+caption+], [+page_title+]
    </[+captiontag+]>
    
    

    Now, to change the link behind the thumbnail, you can replace [+link+] with something like:

    
    	<a href="[+page_url+]">[+thumbnail_content+]</a>
    

    Your example has a lot of data-slb- ... attributes I believe are added by the theme or another plugin. These may still work or you may have to add markup for them.

    I hope that gives you some ideas that will work for your application. Let me know if you have any problems or further questions about the custom template suggestions.

    Again, if you can shed any light on the “lost template” I would be very grateful. I will work on restoring the rollover actions for default templates as wuickly as I can. Thanks for your understanding and your patience.

    Thread Starter cconstantine

    (@cconstantine)

    template/configs loss…

    I don’t recall, for sure, what I did… I just followed the directions in your post which mentioned installing the dev version by following the instructions here …which basically says, go to installed plugins, deactivate and delete, then install the zip file.

    So, did it nuke all my configs? I’m not certain…

    Everything else feels correct; but if there’s some checkbox that flipped to a default, I’d probably not notice. I didn’t notice I lost my template for weeks.

    I definitely didn’t lose the two (“Reviewed”, “Featured”) Att. Categories taxonomy terms that I had created, and have assigned to well over 1,000 images… so I’d say that taxonomy survived the deactivate/delete/install process.

    Uninstall (Delete) Plugin Settings…

    I definitely did not check-and-then-save either of those checkboxes. Those are clearly labeled, and I recognize them as something I’d not want to use. I def deactivated/deleted the release version of the MLA plugin via WP’s normal manipulation screen for installed plugins.

    • This reply was modified 8 years, 5 months ago by cconstantine.
    Thread Starter cconstantine

    (@cconstantine)

    Shortcodes tab under the MLA settings…

    Yes, “Default templates and settings” and “Thumb susti support, mal_viwer” checkboxes down the left. Panel on the right for searching/selecting templates.

    I have “All (12)” including the just-recently-created “craigs-template”. And yeah, it’s filtering to “Any Status”. I’m confident my original/old tempalte is gone.

    My “craigs-template” is the only that doesn’t have “(default)” below it’s name. When I first came in there looking for my template — after finding “mla_template=” in the shortcode — all the templates were “(default)” ones.

    Definitely gone.

    Thread Starter cconstantine

    (@cconstantine)

    Copying the default templates…

    success!

    I got a copy of the default and turned it into my “craigs-default”. Wedged a “HELLO WORLD” into the Item and just set my default as the default Markup Template.

    From there, I edited the value for Item and adjusted the caption part (this is just part of the value for Item):

    [+caption+], from <a href="[+page_url+]">[+parent_title+]</a>

    which gives me the attachment’s caption and the post title of the parent. (This MLA gallery is a super elite selection of singleton images picked out of many many different posts. I Att. Category these few, and they appear in this gallery. These links to the Parent posts let people go there to see the other photos that were posted with the featured one.)

    Anyway, I cannot find anything to link to the Parent… [+page_url+] is the page the [mla_gallery ...] shortcode is on, and [+link_url+] is to the attachment itself… I need a [+parent_link+] or something but I’m not seeing it…

    I think I saw a parent ID, so I could construct an HREF from that… but that feels wrong.

    If you want to see this in action https://constantine.name/featured-photography/

    Plugin Author David Lingren

    (@dglingren)

    Thank you for your investigation and detailed comments. Again, I really regret the loss of your template, and I have no idea who it might have happened.

    If you feel adventurous, you could try repeating the process to see if your new custom template gets lost. 1) Save your settings with the “Export ALL Settings” button. 2) deactivate and delete the Development Version. 3) Install and activate the Development Version. 4) See if your template survived. If not, 5) Import your settings to restore it.

    You can also wait until I have a new Development Version that fixes the rollover actions…

    Thanks again for your help.

    Thread Starter cconstantine

    (@cconstantine)

    Let me know when you have the next dev release ready. (Fixing the mouse-over on the template panel.)

    I don’t need that fix per se, but I can export my settings and try the deactivate/delete/install procedure to see what happens… I’ll know right away if it drops my setting for default template, or drops my template.

    ? does exporting the settings export the Att.Category taxonomy’s terms, and the term assignments to posts ?

    Plugin Author David Lingren

    (@dglingren)

    You wrote “I cannot find anything to link to the Parent …“. My apologies; I wrote too quickly in my earlier post and as you’ve seen, [+page_url+] is not the right answer. The current MLA version gives access to a few parent values but the permalink is not among them.

    I have uploaded a new MLA Development Version dated 20160921 that fixes the rollover action. It also contains an updated example plugin to give you access to the “parent permalink” you need. It would be great if you can install the Development Version and let me know how it works for you.

    To find the example plugin, navigate to the Settings/Media Library Assistant Documentation tab and click the new “Example Plugins” button. Enter “substitution” in the text box and click “Search Plugins”. You should see the example plugin.

    The “MLA Substitution Parameter Hooks Example” plugin is the one you want. You can hover over the plugin name and click the “Install” rollover action to add it to your site. Then, go to the Plugins/Installed Plugins admin submenu, find the plugin and activate it.
    Once the example plugin is activated you can modify your shortcode to be:

    
    <a href="[+parent:permalink+]">[+thumbnail_content+]</a>
    

    You can access all of the values in the wp_posts table. the guid value also links to the page but it is ugly.

    You asked “? does exporting the settings export the Att.Category taxonomy’s terms, and the term assignments to posts ?” The answer is no – the export/import is for option settings (the Settings submenu items) only. Exporting/importing taxonomy terms and relationships is a complicated problem I have not addressed. Other database backup plugins may be helpful…

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

    (@cconstantine)

    Latest dev version…

    I installed the latest MLA dev. I now have v2.33 (20160921) showing in the MLA settings screen.

    My template is still in teh templates list, and it’s still set at the Markup Template dropdown in the Shortcodes tab. ie, worked perfectly.

    …perhaps the problem of lost settings(?) or templates(?) only happens if one goes from the WP-provided/production version of the plugin, to the dev version? …just guessing.

    I note that I now have the ‘Copy’ mouse-over action on all the templates.

    MLA Substitution Parameter Hooks Example plugin…

    I found it, installed and activated it, and [+parent:permalink+] works perfectly in my <a href="".

    THANKS AGAIN for helping me sort out my screwball usage of MLA ??

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and all the good news. It’s not at all “screwball“. Working through applications like yours is the way most new MLA features get started, and I always learn things from working on them. Thanks for the opportunity!

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.40, which contains the fixes and updatedexample plugin I developed for this topic.

    I am marking the topic resolved, but please update it if you have problems or further questions regarding the parent linking for your application.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘What are the default values for the markup template?’ is closed to new replies.