do you know how to put functions into your theme’s function file?
Yes. I have a full child theme set up with a functions.php and modified bbpress templates as well.
Just following up, I have a function I can use to put the button on the page instead of changing the content-single-forum.php page in my child theme, but it still puts it outside the bbp-pagination div so I run in to the same styling issues. I’m not sure what function to use if I want to insert something into that area.
can you give me the function you are currently using to produce this button.
Hrmm, I replied last night and it looks to be gone now. Not sure if I’ve gotten moderated but I’ll put my response here again.
Currently I’m just using this code in the content-single-topic.php template in my child theme.
<a href="/forums/new-topic/?ForumId=<?php echo bbp_get_forum_id()?>"><div class="new-topic btn">New Topic</div></a>
I have developed this for use in function.php to replace the above but I get a parsing error right now. It works ok if I don’t try to insert the ForumID so something is wrong with my syntax.
function pmh_new_topic_btn() {
if ( is_user_logged_in() ) {
echo '<a href="/forums/new-topic/?ForumId=".$_GET['ForumId'].""><div class="new-topic btn">New Topic</div></a>';
}
}
add_action('bbp_template_before_topics_loop','pmh_new_topic_btn');
Regardless of which method I use the resulting code is always placed after the bbp-pagination element and my CSS fu isn’t strong enough to have the button flow/move with the bbp-pagination-links contained within (is it even possible?).
<div class="bbp-pagination">
<div class="bbp-pagination-count">
Viewing 3 topics - 1 through 3 (of 3 total)
</div>
<div class="bbp-pagination-links">
</div>
</div>
<a href="/forums/new-topic/?ForumId=1486">
<div class="new-topic btn">New Topic</div>
</a>
I fixed my function above so this works now:
function pmh_new_topic_button() {
$forum_id=bbp_get_forum_id();
if ( is_user_logged_in() ) {
echo '<a href="/forums/new-topic/?ForumId='. $forum_id .'"><div class="new-topic btn">New Topic</div></a>';
}
}
add_action('bbp_template_before_topics_loop','pmh_new_topic_button');
great – glad you’re fixed
Well I fixed the function so it works (displaying the button), but I still don’t know how to get the button into the position I want.
untested but try
add_action('bbp_template_before_pagination_loop','pmh_new_topic_button');
Thanks. I gave that a shot but it just put it before the pagination elements, not inside.