madbirdesign2 on "[Plugin: Media Library Assistant] Creating a dropdown list of PDF files"

ساخت وبلاگ

Thanks for your update and the kind words. Thanks as well for including the link to your proposed widget. Here is an example you can experiment with.

First you must create a custom markup template for your controls. Navigate to the Settings/Media Library Assistant Shortcodes tab, click on the "Go to [mla_gallery] Markup Templates" link and then scroll down to the blank template. Enter your template parts as follows:

Name:
dropdown-gallery

Arguments:

mla_onchange=''

Open:

<select name='[+template:[+query:dropdown_name+]|mla_dropdown+]' class='gallery-dropdown' id='[+selector+]' [+query:mla_onchange+]> <option class="gallery-dropdown-option" value=""> - Select a document - </[+option+]>

Item:

<option class="gallery-dropdown-option" value="[+attachment_ID+]">[+title+]</[+option+]>

Close

</select>

You can leave the other parts empty. Note the two single-quotes in the mla_onchange argument. Scroll to the bottom of the page and click "Save Changes" to record the new template.

Here's how to use the template to create three dropdown controls in a form, and an [mla_gallery] to display the selected document:

<h3>Meeting Materials</h3>
<form id="mla-text-form" action="." method="post" class="row">
<strong>Agendas</strong>
[mla_gallery attachment_category='agendas' post_mime_type=application/pdf orderby=date order=desc mla_markup=dropdown-gallery]
<strong>Regular Meeting Minutes</strong>
[mla_gallery attachment_category='agendas' post_mime_type=application/pdf orderby=date order=desc mla_markup=dropdown-gallery dropdown_name=mla_dropdown_R]
<strong>Special Meeting Minutes</strong>
[mla_gallery attachment_category='agendas' post_mime_type=application/pdf orderby=date order=desc mla_markup=dropdown-gallery dropdown_name=mla_dropdown_A mla_onchange='onchange="retu this.form.submit()"']
<input id="text-form-submit" name="text_form_submit" type="submit" value="Filter" />
</form>
[mla_gallery]
ids="{+template:{+request:mla_dropdown+}|{+request:mla_dropdown_R+}|{+request:mla_dropdown_A+}|999999+}"
post_parent=all
post_mime_type=application/pdf
size=icon link=file
mla_caption="{+title+}"
mla_viewer=false
[/mla_gallery]

You can paste this content into a standard WordPress page and play around with it. Once you're satisfied you can move the controls into a widget (such as the MLA Text widget).

You can see that I've replaced the link=file columns=1 parameters with the mla_markup parameter to use the custom template. The first two controls are "select only"; you make a selection and the click the "Submit" button to fetch the document. The third control has one more parameter, mla_onchange='onchange="retu this.form.submit()"', that submits the form as soon as a selection is made. This might be more appropriate for the widget; you can copy the parameter to the other two controls to make them all "immediate".

The final [mla_gallery] at the bottom displays a thumbnail for the selected document. Click on the thumbnail to open the document itself. I know this is an extra step, but you didn't specify what should happen when a selection is made. It should be possible to use a plugin such as the excellent PDF Embedder by Dan Lester to open the document within the destination page or use a bit of code to go directly to the document download. Let me know what you have in mind.

In the interim I encourage you to try out the above template and shortcodes. I look forward to hearing your feedback.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 253 تاريخ : شنبه 9 مرداد 1395 ساعت: 1:53