Question

Is there a way to allow attachments with wordpress comments?

I know of a paid plugin that allows this but I was hoping for someone to point me in the correct direction that's future proof and doesn't rely on plugins. Ideally I would want the attachment to be connected to the post itself so we could query all the attachments if needed.

Thanks!

Was it helpful?

Solution

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.

OTHER TIPS

There is atually, it's more than simple, you just need to install this plugin:

http://wordpress.org/plugins/comment-attachment/

Then in Settings > Disscussion, you will have new options, where you set whatever you wish to happend and you're good to go.

Plugin settings in admin

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top