Sounds like you’re further through hacking the code than most people get !
ok, just in case you haven’t already seen it, if you’re changing the template files, you should create a bbpress directory in the root of your (child)theme, and copy the files there. bbPress will then use these instead, and they won’t get overwritten by upgrades to bbpress. You should also have a child theme, and put them in there rather than someone else’s theme, and then theme updates won’t overwrite them either!
see
Step by step guide to setting up a bbPress forum – part 2
and
https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum-part-3/ section 3
I presume you’ve tried the code? That’s the other great thing about using the bbpress folder in your child theme, you can just delete the server version and it goes back to the default one.
If so where is it falling over?
can you copy the lines between
<?php do_action( 'bbp_theme_before_topic_started_by' ); ?>
and
`<?php do_action( ‘bbp_theme_after_topic_started_by’ ); ?>
and paste them into here, and I’ll take a look
I’m out today, but if I get a chance later I’ll then run it and debug for you.
Yeah i have been using a child theme,
I havent put every file from bbpress in my child theme
Im just making small changes to the template files and only throw in the ones that i changed into my theme.
And i use my themes custom css plugin for css changes.
I really dont have anything to debug, i just have bits of php to try to make my desired function
Like i know bbp_get_topic_freshness_link
, shows the time ago of the last post
And that <?php bbp_author_link( array( 'post_id' =>bbp_get_topic_last_active_id()
gets ahold of the author of the last post in a topic
<?php printf( __( 'Last Post: %1$s'
lets me have my custom text with the attributes from the function
I just dont know how to put that all together to get the function that i want
Right now all in my function is
<?php do_action( 'bbp_theme_before_topic_started_by' ); ?>
<span class="bbp-last-post-by-author"><?php printf( __( 'Last Post: %1$s', 'bbpress' ),bbp_get_topic_freshness_link( array() ) ); ?></span>
<?php do_action( 'bbp_theme_after_topic_started_by' ); ?>
“I havent put every file from bbpress in my child theme ”
yes that’s fine, you only need to put in files that you have changed.
I’ll look at the rest of your comments shortly !
you were pretty much there
the following, which is just two lines nicked from elsewhere and joined by a ‘by’ text should do what you want
<span class="bbp-last-post-by-author"><?php printf( __( 'Last Post: %1$s', 'bbpress' ),bbp_get_topic_freshness_link( array() ) ); ?></span>
<?php _e(' by ', 'bbp'); ?>
<span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 14 ) ); ?></span>
Come back if that’s not what you wanted !
@robin-w worked like a charm, thank you very much for the help!
Hello,
I’m not good at code. Can you please step by step what to do?
I added following code to function.php childe-theme, it leaved me a blank page.
<span class=”bbp-last-post-by-author”><?php printf( __( ‘Last Post: %1$s’, ‘bbpress’ ),bbp_get_topic_freshness_link( array() ) ); ?></span>
<?php _e(‘ by ‘, ‘bbp’); ?>
<span class=”bbp-topic-freshness-author”><?php bbp_author_link( array( ‘post_id’ => bbp_get_topic_last_active_id(), ‘size’ => 14 ) ); ?></span>