I took over this plugin as it was abandoned, and I did enough to get it working again. So support is limited.
This code will I hope add a custom post type
// add custom post_type to bbpress topics for posts plugin
global $bbppt_post_type ;
global $bbppt_post_type_name ;
$bbppt_post_type = 'event' ;
$bbppt_post_type_name = 'Events';
//add to eligible post types
add_filter( 'bbppt_eligible_post_types', 'bbppt_add_post_types');
function bbppt_add_post_types ($content) {
global $bbppt_post_type ;
array_push($content, $bbppt_post_type);
return $content;
}
//add to exclude options
add_filter( 'bbppt_ex_options', 'bbppt_add_ex_options');
function bbppt_add_ex_options ($ex_options) {
global $bbppt_post_type ;
$ex_options['post_type_'.$bbppt_post_type] = false ;
return $ex_options;
}
//add to default options
add_filter( 'bbppt_ex_options_default', 'bbppt_add_default_options');
function bbppt_add_default_options ($ex_options) {
global $bbppt_post_type ;
$ex_options['post_type_'.$bbppt_post_type] = 'on' ;
return $ex_options;
}
//add to discussion_defaults
add_action ('bbppt_discussion_defaults' , 'bbppt_add_discussion_defaults', 10 , 2 ) ;
function bbppt_add_discussion_defaults ($ex_options, $forum_select_string) {
global $bbppt_post_type ;
global $bbppt_post_type_name ;
?>
<input type="checkbox" name="bbpress_discussion_defaults[post_type_<?php echo $bbppt_post_type ?>]" id="bbpress_discussion_defaults_post_type_<?php echo $bbppt_post_type ?>" <?php checked($ex_options['post_type_event'],'on') ?>>
<label for="bbpress_discussion_defaults_post_type_<?php echo $bbppt_post_type ?>"><?php printf(__('Do this for new '.$bbppt_post_type_name,'bbpress-post-topics'), '</label>', $forum_select_string); ?>
<br />
<?php
}
add_action ('bbppt_discussion_apply' , 'bbppt_add_discussion_apply', 10 , 2 ) ;
function bbppt_add_discussion_apply ($apply, $ex_options) {
global $bbppt_post_type ;
global $bbppt_post_type_name ;
if ($ex_options['post_type_post']== 'on' || $ex_options['post_type_page']== 'on') $apply.=' and ' ;
if ($ex_options['post_type_'.$bbppt_post_type]== 'on') $apply.=' '.$bbppt_post_type_name ;
return $apply ;
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
https://en-gb.www.ads-software.com/plugins/code-snippets/