Here is my suggestion:
Just download this Comment Images plugin.
As of now it only support images. But upload work with all file types.
So just make a little tweak like this. So it will display attachment link.
Replace line 245 from
$comment->comment_content .= '<img src="' . $comment_image['url'] . '" alt="" />';
to
$comment->comment_content .= '<a href="'. $comment_image['url'] .'">Download attachment</a>';
But you mentioned, you want that function in theme instead of plugin. So if you really know what you are doing, just integrate that whole plugin code in your theme by changing file path.
Otherwise, just hire a programmer.
Related Posts:
- WordPress comment count to include attachment comments
- How to get comment images stored as serialized comment meta
- how show attachment image in comments query
- How do I comment out a block of tags in XML?
- R: Comment out block of code
- How to enable comments for pending and draft posts?
- Comments not appearing at all
- A plugin where users can comment with Facebook or Twitter or OpenID [closed]
- Reverse comment pagination numbers
- Comment Count for each Comment Author
- Show comments from multiple post IDs in comment template
- get recent comments of a particular category
- Sticky Comments
- Whitelisting Commenters
- WP_Comment_Query() displays “password protected” comments?
- Comments number message in password protected post
- Disable Comments Feed
- Use rich text editor in comments?
- Add a custom class to awating comments
- How to add custom comment fields but *only on the comment reply form*?
- Is it possible to move a comment that should be a reply to another comment?
- Can I seperate comments from post?
- Show only posts which can be commented
- What should I hook to add extra fields to comments?
- Get a variable field of all comments of current post
- Average Score of all ratings in comments
- Making a Comment on a page without being on that page?
- How do I display the commentor’s first name and last name in the comments?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, func
- How To Disable Comments On New Page
- What is the server IP comment hack
- Do I have to have a nonce for a custom comment field?
- Get last seen date/time in wordpress get_comments() [closed]
- Report spam button
- Recent comments from my blogs only
- Disable or Enable Comments on Front end [closed]
- Change username to nickname in comment section
- Hide notifications regarding new comments
- How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved
- Are there any “YouTube-styled” commenting systems for WordPress?
- comments.php keep comment date/time but remove date/time’s #hyperlink
- how to change comment author’s link from user’s website to author’s page(author.php)?
- Add class to comment form div when comment-reply button is clicked
- Add filter to comments loop?
- Disabling archives, search results, comments, etc?
- Pagination Comments Doesn’t Show
- Show comments to unregistered users
- WordPress comments – how to check if comment still needs to be approved?
- PAIN. Comments Pagination
- How to retain comment text on comment form after login/registration?
- Adding character count and limit in comments, modifying labels and fields – jetpack
- Troubleshooting Emoji in Comments
- Change id=”respond” to the comments container
- Comments on Author page
- Why could my comment_form variable not be working?
- How to block comments and pings?
- Woocommerce comments subscription [closed]
- Can I turn off further comments on a single page?
- How to remove the number of a comment in the url slug?
- How to prevent multiple comments
- Hide comments on specific pages, not just disable future comments
- How to permanently delete pages I have already trashed?
- Additional content every x comments
- How to display category name from commenter’s custom post
- Add comment_meta to wp_comment_reply
- How do comments work?
- Can’t reply to comments [closed]
- What’s the difference with trash_comment and wp_trash_comment?
- How can i change the order of comments?
- ask and edit an extra comment field
- Modify links in user comments
- Refresh individual comment text via API
- How to filter comments by comment_meta
- Prevent users to delete comments from trash
- How can I hide comment of the authors from their published posts?
- How to display replies to his comments in user profile of current user
- How do I refresh “Post Last Modified Time”, as long as comment is updated to Approve status?
- Top rated posts Average rating issue
- Need to output comment_form() function inside a foreach loop
- stop url changing when user comments
- Comment field override
-   not working in comments
- Badges for Guests based on their comment counts [closed]
- How to add a class to comment submit button?
- WordPress Commenting System User access and Security
- WordPress Comments – Only show part of user name
- URLs to user page is broken
- Comments Template shows, but not the comments
- Broken comments section – WordPress 2014 Theme
- Need an advice about comments
- Force logged in users to provide more data when commenting
- How do I get the comments section to show up?
- By Default, Turn Comments Off for Pages & Leave Comments On for Posts
- same comment list for two posts
- Replace do_action() with a normal submit form in comments.php
- Getting thousands of spam comments
- edit-comments.php in Admin – how to change ‘Comments’ title?
- Comments on pages not appearing, even though I enabled them
- Stop future commenting on specific post
- comment_approved custom value