This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

COP PDF Attachment Menu

Descripcion

Adds a shortcode [pdfmenu] and a widget that defaults to displaying an unordered list of all pdf’s attached to the current page or post.

There are options for both altering the query to return a different set of attachments and for formatting the output.

This plugin should always default to:

<ul class="cop_pdfmenu">
    <li class="attachment/pdf"><a href="(direct uri to attachment)" target="_blank" title="(attachment title)">(attachment title)</a>
</ul>

The attachments will be ordered by date in the ascending order by default.

Shortcode Options include:

  • Change list types ol, li, div (nested divs).
    • [pdfmenu list_type= »ul »]
    • [pdfmenu list_type= »ol »]
    • [pdfmenu list_type= »div »]
  • Set a different class on the container.
    • [pdfmenu class= »differentclass »]
  • Set a different target.
    • [pdfmenu target= »differenttarget »]
  • Get a list of pdfs from a different parent.
    • [pdfmenu post_parent= »1″]
  • Change the number of pdfs to return. (currently no paging).
    • [pdfmenu numberposts= »-1″] (returns all attachments)
  • Change the post_mime_type to query for a different type or multiple types.
    • [pdfmenu post_mime_type= »application/zip »]
  • Force download of the attachments
    • [pdfmenu dowload= »all »] (force download of all listed attachments)
    • [pdfmenu dowload= »application/pdf »] (force download of a single mime type)

Widget Options include all of the shortcode options and add some selectors for altering the query and output.

Installacion

Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.

FAQ

How can I style the mime type classes that are now output?

You will now see <li class="application/pdf"> (or your selected mime type) in the code. But you can’t type the / in your stylesheet!

In order to refer to this style you need to change the / to \2f in your classname.

So it looks like

.application\2fpdf { 

}

That solution reduces that amount of code required to output the class and only sligthly increases the complexity of styling. It is the least code approach rather than the most user-friendly approach. Which I think is better in this case.

More Questions Please.

Questions / Donations

Reviews

3 setembre 2016
Great plugin, works just as described. Allowed me to do a bit of extra custom coding to display PDF files on a client website I manage. Looks great, and best of all, it works flawlessly still, even after 2+ years it's been installed on the website. Thanks for sharing!
Read all 2 reviews

Contributors & Developers

“COP PDF Attachment Menu” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

0.1.1

  • First WordPress 4.0 testing
  • Added the first version of paging to the shortcode and widget functionality so that you can set numberofposts and your attatchments will show page navigation within the page.
    • This should fix but not necessarily modify the previous default behavior as it appears that the previous version was output the page numbers but they were not functioning.
    • Paging only works appropriately with a single instance of paging per page. Multiple instances will all navigate between pages together.
  • Added the [attachments], and [attachmentmenu] shortcode. I haven’t checked to see if [attachments] creates conflicts with other plugins. This has the same functions but it defaults to listing all mime types rather than just pdf files. Use with caution, this may be renamed if I discover I’m overlapping with another plugin. [attachmentmenu] is more in line with future plans I have and will should be safer.
  • Cleaned up extract code from the shortcode.
  • Added a span of class= »sep » to the | in the paging so that it can be styled but still have a default appearance that is functional.

0.1.0

  • Added download= »(mime type) » and download= »all » which converts links to forced download links. Allows other types (all types not tested).
  • Widget also allows you to set the mime type to force downloads
  • Thanks to sallydeford for suggesting forced download links as an option.

0.0.9.8

  • Just updating things for the plugin page.

0.0.9.7

  • IMPORTANT Change. The widget (not the shortcode) was showing all pdf files with the default settings instead of just the attachments to the current post. Should be working now.

0.0.9.6

  • Fixed error with shortcode showing all types by default

    Thanks to sallydeford for pointing out the issue.

0.0.9.5

  • Added options to display captions and descriptions.
  • style captions with .the_caption
  • style description with .the_description

0.0.9.4

  • Minor Fixes to new features. (Was defaulting in the widget to « all types »
  • Added localization functions.

0.0.9.3

  • Added [pdfmenu all_types=’true’] to the shortcode.
  • Added and all types checkbox to the widget.
  • All items have thier mime type as a class (ex. class= »application/pdf »).

0.0.9.2

  • Adding the mime type as a class to each list item ( ex. class= »application/pdf » ). Would have added it to the container but I wanted to be able to later add the output and styling of attachments of multiple mime types in a single list.
  • Changed basic ownership details of the plugin to point to my current site www.agreenweb.com.

0.0.8

  • Minor changes to the widget editor

0.0.7

  • Added ordering options to the widget settings.

0.0.6

Shortcode

Added orderby and order to the shortcode options for reordering.

defaults are:

  • orderby = « date »
  • order = « ASC »

In Progress

  • Started adding paging.
  • Add offset= »x » or paged= »x » with a numberposts= »(number) » that is not zero to the shortcode.
  • In order to get another set of links.
  • There is not yet any navigation.

Widget

Added an option to add a title.

Did some debugging.

0.0.5

Added a check requiring php version 5.2.1 on install.
Moved more code into classes.

0.0.4

Added custom widget class. No change to function.

0.0.3

Improved the widget options.

0.0.2

Added basic widget that functions the same as the shortcode.

0.0.1

Initial Version