문제

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!

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top