Sincerly I don't know how Buddypress and bbPress add options to page templates dropdown, and I can be wrong, but I think the only way to do it (excluding adding files to theme folder or hacking core), is to use javascript.
Create a file containing the following, save it somewhere, I will assume it is named my-script.js
and it's in a subfolder 'js'
of the theme folder
jQuery(document).ready(function($) {
if ( $('select#page_template').length ) {
var tmpl = myscriptdata.template;
var label = myscriptdata.template_label;
$('select#page_template').append('<option value="' + tmpl + '">' + label + '</option>');
}
});
Then enqueue it in post.php
and post-new.php
, only for pages, and passing the template you want to add:
add_action('admin_enqueue_scripts', 'add_my_scripts');
function add_my_scripts( $page ) {
if ( $page === 'post.php' || $page === 'post-new.php' ) {
global $typenow;
if ( $typenow === 'page' ) {
wp_enqueue_script('myscript', get_template_directory_uri() . '/js/my-script.js', array('jquery'), null);
$data = array(
'template' => "my-template", // what you want to assign to dropdown value
'template_label' => "My Template" // what you want to assign to dropdown label
);
wp_localize_script('myscript', 'myscriptdata', $data );
}
}
}