Add Featured Image to New Topics in Frontend WYSWYG
-
Hey folks!
Please forgive me if I’m missing something obvious. I’m looking to allow users that are creating new topics on the frontend of my BBPress-based site, to add a featured image to their topics.
This image wouldn’t appear in their topic itself. Instead, the featured image would exist on indexed pages listing a series of topics in one area. Does this feature exist in a plugin, or is there a more customized way to add this feature?
Thanks!
-
I’d also like a featured image for forum topics.
As it is now, the image displayed for a forum topic in a RSS reader such as Feedly is the distorted poster’s gravatar image. Which is bad.
Any plans for this, please? Feedback would be much appreciated.
Thanks,
CristianSeems to still work.
add_post_type_support('topic', array('thumbnail'));
add_post_type_support('forum', array('thumbnail'));
<?php echo get_the_post_thumbnail($post_id, 'full'); ?>
Allowing untrusted users the ability to upload images to your site is one of those frequently requested but still pretty risky features we’ve so-far shied away from.
WordPress (and most server configs) don’t do the type of strict file/mime type checks you’d want before enabling this, so JPGs and GIFs can embed other weird stuff and most sites would have no idea.
There are some plugins out there to enable it, but it’s not something we’ll include with bbPress proper until WordPress (and most hosts) have a better setup under the hood.
My code (comment) is for backend, metaboxes. Or so I believe.
I would like my featured image to work as well. My users are not allowed to add their own topics, so this would be a feature for me to use alone. I create all of my forum topics in the back-end. There is a Set Featured Image option on forum topic pages, but it doesn’t show up anywhere.
Thank you for your time!
Take care,
KariStagger Lee, where did you add this code? Does it only bring up the image in forum or topic lists or does it appear on the forum page?
In theme functions.php or custom field with functions.php.
It gives featured image metaboxes in backend. Then you display featured image on front as any other post type featured. See how your theme is doing this and copy/paste whole code block.As you need only fetaured image allowed for admins and moderators you can use this:
add_post_type_support('topic', array('thumbnail')); add_post_type_support('forum', array('thumbnail')); /* Plugin Name: bbPress - Forum Icons Plugin URI: https://gist.github.com/ntwb/8277457 Description: bbPress - bbPress - Forum Icons Version: 0.1 Author: Stephen Edgar - Netweb Author URI: http://netweb.com.au */ // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/ add_post_type_support('forum', array('thumbnail')); function ks_forum_icons() { if ( 'topic' == get_post_type() ) { global $post; if ( has_post_thumbnail($post->ID) ) echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon')); } } add_action('bbp_theme_before_topic_title','ks_forum_icons');
I will see later what is the best way to allow all Users to set topic featured images.
But dont see much point in it. Thousands of forum topics, thousands of images on server x all WP image sizes. Big mess.Here is code for forum index, forum featured images, not topics:
/* Plugin Name: bbPress - Forum Icons Plugin URI: https://gist.github.com/ntwb/8277457 Description: bbPress - bbPress - Forum Icons Version: 0.1 Author: Stephen Edgar - Netweb Author URI: http://netweb.com.au */ // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/ add_post_type_support('forum', array('thumbnail')); function ks_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 forum-icon')); } } add_action('bbp_theme_before_forum_title','ks_forum_icons');
Thank you so much for your help @stagger-lee! This code did work, however, it seems to only be for forum lists, which is an option already included in the bbp style pack plugin. I am trying to get the featured image to show up on the forum’s page itself (like what they do in buddypress groups) I don’t have forum lists accessible on my site so it’s not relevant to what I am doing. Thanks again for taking the time to post this tho!
By the way… what I did end up doing which has been a real good work-around, is use the bbp style pack single forum short code to show my forums as pages. This has been great, because it allows for much more modification! So I just added my featured image to each forum’s page.
Biggest problem with all of this is it wont allow you to edit, change featured image from front-end. Just to insert it frist, and only one, time. If Admins would be nice with giving Participants access to backend than all those problems would not exist.
Here it is.
You hijacked topic a bit.
I still dont understand why you use bbPress as Blog/Posts tool when WordPress is made for this. Almost as you are not so good on theming, and looking for shortcuts.– Make own image size
– Change “slider” to name of own image size.
– There is a class to center image, give it maybe some gray background for smaller featured mages. fix margins and paddings, etc…function ntwb_bbpress_random_single_topic() { global $post; if ( has_post_thumbnail($post->ID) ) echo get_the_post_thumbnail($post->ID,'slider',array('class' => 'forum-topic-featured')); } // Hook into action add_action('bbp_template_before_lead_topic','ntwb_bbpress_random_single_topic');
I’m surprised that this issue persists. We are looking to develop an interactive blog function in which everyone sees images on everything all the time, without needing to realize that they are in WP and bbPress handles everything but images well. Even with Mediapress or any of the various image attachment and styling plugins, the limitations on displaying image posts persists.
Assuming that I’m not interested in someone else’s concern over the integrity of the uploaded files, has anyone found a plugin, piece of PHP or any other means to display the posts in a topic or forum, along a thumbnail image?
I feel like by this point, we should be able to display topic indexes and posts as a list, a grid, masonry or something that looks rather like FB, all with images included.
What is the obstacle, and more importantly, are there solutions?
I’m confused as to why there is simply no featured image for Topics. This makes bbPress virtually unusable for any purpose other than tech support and ticket management. I would suggest there are better tools for that anyway.
If you are trying to manage a blogging platform, every single post, in this case a topic, simply MUST have the option of attaching a featured image. Reasonable people could have always agreed to disagree how important the security aspects of uploading images are or are not, but that horse has long since left the barn.
Assuming we either trust our community or really just don’t care about whatever concern drove this decision, why can’t we simply have a featured image that people who are uncomfortable can turn off?
Can you offer even one single reason why we don’t have this?
you seem to completely misunderstand open software foundation software, so you would clearly not understand a response
I’m willing to give it a shot. There have been requests for this functionality for the better part of 10 years and not a single meaningful response.
You seem to have the ability to do some cool things. What is the resistance on this issue about?
If we need to be educated, please educate us. To simply not respond, pretend you don’t understand and/or tell everyone who asks that they are dumb to ask is not very productive.
You are asking someone to write code in their free time to do something that their code wasn’t intended to do.
it’s that simple
- You must be logged in to reply to this topic.