coldsraka.blogg.se

Attachment filr gallery wordpress
Attachment filr gallery wordpress







attachment filr gallery wordpress
  1. #ATTACHMENT FILR GALLERY WORDPRESS HOW TO#
  2. #ATTACHMENT FILR GALLERY WORDPRESS PDF#

If you plan to use this only on a single page, I would recommend adding a conditional statement (using either is_page() or is_post()) inside your main theme file that checks to see if the user is viewing the specific page on which you want to show the list of PDF files. * that is returned when there is no attachment associated with * does not equal "Missing Attachment", as that is the string * conditional that checks to make sure the $attlink variable * If you remove this conditional, you should replace it with a * Change the file extension if you want to show a different type * Remove this conditional statement if you want to show all attachments

attachment filr gallery wordpress

* A simple check to see if this includes a link to a PDF file $attlink = wp_get_attachment_link($attachment->ID) This solution creates an unordered list of the PDF attachments in alphabetical order. I did a little more research and came up with a slightly better (in my opinion, at least) solution.

attachment filr gallery wordpress

I wanted it formatted into a nice list and, since the “titles” of my attachments were set appropriately and were being used as the text of the link, it seemed silly to show the title twice. Unfortunately, all I had was a jumbled blob of attachment names and links to the attachments. I inserted that code into my template file and checked out the page.

After some quick Googling, I found some information in the WordPress codex explaining basically how to insert a list of attachments in a page or post. Then, I remembered that anything uploaded through the image uploader is stored as an “attachment” in the database. In my case, that meant a blank space where I wanted the list of PDF files to appear (since, obviously, none of them are images). Unfortunately, I soon figured out that the “gallery” only displays images. At first, I attempted to simply upload all of the PDF files using the WordPress image uploader, and then inserting a “gallery” at the foot of my post. This evening, I found myself in the unique position of needing to display a list of PDF files at the bottom of a WordPress page.









Attachment filr gallery wordpress