By gibsonoliver on
How do I get attchments to display in reverse order?
I would like to add a monthly publication to a page and it would be great if the latest issue was at the top of the list (at the moment it would automatically be added to the bottom of the attachment list).
Comments
template.php
Put the following in template.php (I'm assuming you're using the upload module and thus slightly altering theme_upload_attachments)
...
or you could simply reverse the array and then call the "base class":
Sweet
Sweet! That worked for me. Note: the modification goes to the theme/theme_name/template.php file.
This is exactly what I need
This is exactly what I need but for some reason it's not working for me. What am I doing wrong?
I've added the lines to the bottom of the template .php in themes/garland/ (which is the theme I'm using, of course)
So my edited file now looks like this:
I've tried both methods listed in this post, but no luck. Where have I gone wrong?
Still looking for some help
Still looking for some help please. Why is none of this working for me (see my previous post)?
...
(EDIT: ignore; duplicated reply.)
...
(When you paste big chunks of code people are less likely to help you because they have to wade through all of it. You could have just pasted that last function ;-)
Perhaps you're not using the 'attachment' module? Other modules may have differnet theming function(s).
Replace that function with the following:
if you don't see the asterisks you know this function was ignored.
Thanks
Thanks mooffie.
Unfortunately I don't know enough about coding to know which bits to leave out. So, sorry about the lengthy code. I depend on good, helpful and willing folks like yourself to enable me to have my very humble website working - and for that help I am very very thankful.
I have discovered that the order is now reversed (using the same, unchanged code) but NOT when I am logged in as administrator. Is seems to only work when not logged in. Does anyone have any thoughts on that?
re:Reversing the display order of attachments
fantastic - that works really well, thanks for your help, Oliver.