Add the following code to your functions.php
function forum_icons() {
if ( 'forum' == get_post_type() ) {
global $post;
if ( has_post_thumbnail($post->ID) )
echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft'));
}
}
add_action('bbp_theme_before_forum_title','forum_icons');
Hope it helps 😉
@yanseo thanks for the snippet. It works perfectly! Do you have any idea how i would change the code to add the thumbnail for sub forums instead?
The forum index looks something like:
PARENT FORUM
*sub-1
*sub-2
*sub-3
I attached a featured image to each sub forum. I would like those images to show where the asterisk is.
I tried changing the action in your code to ‘bbp_theme_before_sub_forums’ but it still spits out the thumbnail/featured image for the Parent category.
Any ideas?
J
Hi @yanseo, @jimmmy …this is exactly what I needed..but, im not sure why its not working for me…i dont see any change….I put this snippet into my functions.php of my site theme, correct?
Once I put it there, then what do I do?… :-/
Any reply would be greatly appreciated..thanks!
I keep getting an error message when trying to upload a ‘featured image’ on the forum page..saying: “An error occurred in the upload. Please try again later.”
I cant seem to get it to work..
Anyone found a fix for this?
Which part? Do you have the featured image showing on the parent? Client ended up ditching subforums, so not sure how i ended up solving this. If you can’t figure out the parent, i can try and find what i did…
write code in wp-content/themes/your_theme/functions.php