Reply To: BBP function to automatically make forms on separate pages?
ok, so create a new topic form template
find
wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
transfer this to your pc and edit
change around line 199
<?php if ( ! bbp_is_single_forum() ) : ?>
to
<?php if (isset($_REQUEST['bbp_forum_id'])) : ?>
<input type="hidden" name="bbp_forum_id" value="<?php echo $_REQUEST['bbp_forum_id']; ?>" />
<?php elseif ( ! bbp_is_single_forum() ) : ?>
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpress
where %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/form-topic.php
bbPress will now use this template instead of the original
then put this in your child theme functions file
add_action ( 'bbp_template_before_single_forum', 'reww_new_topic_button' ) ;
function reww_new_topic_button () {
$url = $url = get_home_url();
$forum_id = bbp_get_forum_id() ;
$url.='/topic-form/?bbp_forum_id='.$forum_id ;
$text = 'create new topicc' ;
echo '<a class="hello" href ="'.$url.'">'.$text.'</a>' ;
}
where ‘/topic-form/’ is the page you have the topic form on
that sends a query string to the topic form page, which is then picked up by the amended template above