Get_Forum_Name from functions.php
-
I’m trying to get a default featured image to display using a filter of “post_thumbnail_id” in my child theme’s functions.php file. I’m able to add a default thumbnail for post_type of topic, but I’d like it to be a custom thumbnail based on the id, or name of the forum the topic is in. Here’s what I have so far:
function my_filter_thumbnail_id( $thumbnail_id, $post = null ) { if ( $post->post_type != 'topic' ) return $thumbnail_id; $forumname = get_forum_name( $post->forum_id ); if ( $forumname == "wellness") $thumbnail_id = 7091; return $thumbnail_id; } add_filter( 'post_thumbnail_id', 'my_filter_thumbnail_id', 20, 5 );
The issue is, “get_forum_name(),” is an undefined function. I’m not looking to override the default functions of bbPress, just be able to access the forum_id or forum_name from my theme’s functions.php file. Any help would be greatly appreciated! Thanks
- You must be logged in to reply to this topic.