When writing a new post, WordPress provides the feature to upload files and embed them to the post. But you have to embed every file separately.
And you don’t have special functions, like giving the file links or images a certain class (for CSS styling).
Or perhaps you use the the_excerpt(); function which has the attribute not to show pictures or links.
Another need might be the possibility to link the uploaded files without showing the post (maybe for a special archive e.g.).
To solve these problems you can use this plugin.
The plugin call can be put anywhere inside the loop.
And if there were uploaded items in the post, the plugin will link or respectively show them, even if they are not embedded to the post.
Just upload the files – that’s all.
Summary of functions:
- The plugin links to all files who are uploaded by a post – you dont’ have to embed them to the post
- Images can be linked or shown directly
- File description is used as link text. If there is no description, the title (filename if not set) will be used
- Links and images have the class=”attachment” – the class can be changed by parameter
- You can prevent files from being listed by writing – (to minus) anywhere in the file description
- Special text or code can be used before and after every link item
0.2.1: Added compatiblity for WordPress 2.3.
Download ZIP and unzip. Upload link-uploaded-files.php to your /wp-content/plugins/ directory.
Go to admin backend and activate the plugin.
Put the following code into the template files of your theme, just where you want to show the file links:
<?php zg_uploaded_files(); ?>
Remember, that the code must be inside the loop.
TRUE (default) – images are shown, not linked
FALSE – images are linked
Class (class=’ ‘) of the link or image, for styling with CSS. Default isattachment.
Code (HTML) that is used in front of every link. There is no default.
Code (HTML) that is used after every link. Default is <br />.
<?php zg_uploaded_files('show_images=FALSE&link_class=attach-link&before=<strong>Download: </strong>'); ?>
<ul><?php zg_uploaded_files('before=<li>&after=</li>&show_images=FALSE'); ?></ul>