其實有兩種方式可以實現,薇曉朵技術論壇用的是插件方式,便於用戶使用。
代碼的話如下:
add_filter( 'bbp_after_get_the_content_parse_args', 'bavotasan_bbpress_upload_media' );
/**
* Allow upload media in bbPress
*
* This function is attached to the 'bbp_after_get_the_content_parse_args' filter hook.
*/
function bavotasan_bbpress_upload_media( $args ) {
$args[fusion_builder_container hundred_percent="yes" overflow="visible"][fusion_builder_row][fusion_builder_column type="1_1" background_position="left top" background_color="" border_size="" border_color="" border_style="solid" spacing="yes" background_image="" background_repeat="no-repeat" padding="" margin_top="0px" margin_bottom="0px" class="" id="" animation_type="" animation_speed="0.3" animation_direction="left" hide_on_mobile="no" center_content="no" min_height="none"]['media_buttons'] = true;
return $args;
}
添加到你的主題或者子主題的 function.php
文件裡面。
插件的話請看這裡:https://bbs.weixiaoduo.com/topic/16059
2016-01-09 22:40:24 增加第三種方式,允許 bbPress 論壇用戶上傳圖片;
使用插件實現,可以讓用戶自行上傳圖片。
這裡下載: https://bbs.weixiaoduo.com/topic/17573
收錄於薇曉朵技術論壇,原帖地址:https://bbs.weixiaoduo.com/topic/17273