Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Featured Image to New Topics in Frontend WYSWYG


  • goldnuggets24
    Participant

    @goldnuggets24

    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!

Viewing 8 replies - 1 through 8 (of 8 total)

  • Cristi S.
    Participant

    @cristiscu

    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,
    Cristian


    Stagger Lee
    Participant

    @stagger-lee

    Seems 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'); ?>


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    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.


    Stagger Lee
    Participant

    @stagger-lee

    My code (comment) is for backend, metaboxes. Or so I believe.


    kariellen35
    Participant

    @karilistermanyahoocom

    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,
    Kari


    kariellen35
    Participant

    @karilistermanyahoocom

    Stagger 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?


    Stagger Lee
    Participant

    @stagger-lee

    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.


    Stagger Lee
    Participant

    @stagger-lee

    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');
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar