Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I get topic’s picture URL?


  • Julia
    Participant

    @sub0810

    The bbress Support 7 years ago. Topic Thumbnails?

    
    add_action( 'bbp_theme_before_topic_title', 'assylumn_insert_thumbnail' );
    function assylumn_insert_thumbnail() {
    	echo('<a href="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg">') ; 
        echo('<img class="bbp-topic-thumbnail"  width="100%" style="max-width: ' . get_option('thumbnail_size_w') . 'px; max-height: ' . get_option('thumbnail_size_h'). 'px; vertical-align:middle;" src="http://www.mysite.com/wp-content/uploads/2013/09/picture.jpg"/>' .'</a>');
    	}
    

    I did not know how to get the url in each topic pictures using plugin, GD bbPress Attachments.
    Please show me other code to get the url in the topic pictures.

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

  • Julia
    Participant

    @sub0810

    Add other method.
    I have succeeded to set the images on topic index page.
    but I have no idea to change images to thumbnails.

    Do you have any ideas for thumbnails?

     
    function action_bbp_topic_row_actions() { 
       if ( have_posts() ) while ( have_posts() ) : the_post();
      
        $medias = get_attached_media( 'image', bbp_get_topic_id() );
        foreach($medias as $media){
          the_attachment_link( $media->ID );
        }
       endwhile;
      }
    add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 ); 
    

    Julia
    Participant

    @sub0810

    I could get the code to set on the thumbnails in the topic index page using GD bbPress Attachments.

    
    function action_bbp_topic_row_actions() { 
    
        $medias = get_attached_media( 'image', bbp_get_topic_id() );
        
        foreach($medias as $media){
        the_attachment_link( $media->ID,false );
        }
    } 
    add_action( 'bbp_theme_before_topic_title', 'action_bbp_topic_row_actions', 10, 0 ); 
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar