Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Pascal Casier

    (@casiepa)

    Hi,
    Is your site and forum public? If so, can you post the link?
    It works on some other sites that I know, so it should be a local issue
    Pascal.

    Thread Starter tronix-ex

    (@tronix-ex)

    Its on staging environment.

    Plugin Author Pascal Casier

    (@casiepa)

    Sorry for the late reply, but did you manage to fix this ? I could be a CSS or theme issue.

    Thread Starter tronix-ex

    (@tronix-ex)

    Hi Pascal,

    I uninstalled the plugin and created my own function.

    Thanks,

    Plugin Author Pascal Casier

    (@casiepa)

    OK!
    If you want to share your function and want me to embed it into the toolkit, I can do it.
    Pascal.

    Thread Starter tronix-ex

    (@tronix-ex)

    Thanks for your response but the function is not really a featured image its an extra field. When people starting a topic they just put the image url in the field.

    I hope This will help alot of people

    //Creating a custom field in the bbpress topic form
    add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
    function bbp_extra_fields() {
       $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
       echo '<p><label for="bbp_extra_field1">Thumbnail Image URL</label><br>';
       echo "<input type='text' name='bbp_extra_field1' value='".$value."'></p>";
    }
    //Processing & Saving the custom field values
    add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
    add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );
    function bbp_save_extra_fields($topic_id=0) {
      if (isset($_POST) && $_POST['bbp_extra_field1']!='')
        update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
    }
    
    //Displaying custom values in the content as a featured image
    add_action( 'bbp_theme_before_topic_title', 'assylumn_insert_thumbnail' );
    function assylumn_insert_thumbnail() {
    	$topic_id = bbp_get_topic_id();
    	$value1 = get_post_meta( $topic_id, 'bbp_extra_field1', true);
    	if ( $value1 ) {
    		echo('<a href="' . bbp_get_topic_permalink($topic_id) . '">') ; 
        	echo('<img class="bbp-topic-thumbnail"  width="60" height="60" src="' . $value1 . '"/>' .'</a>');
    	}
    }
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Featured Image Option’ is closed to new replies.