Skip to:
Content
Pages
Categories
Search
Top
Bottom

Topic Thumbnails?


  • assylumn
    Participant

    @assylumn

    Hi,

    I am new to BBpress and was wondering if there was a way to display a small thumbnail logo next to each topic within a forum.

    I am aware that there is a plugin that does this, however, that pulls an image from the topic itself and I want a standard image (site logo) to appear by each topic post.

    Here is an example of what I wish to achieve: http://techiteasy.co/forums/forum/android/

    The theme I am using was created in Artisteer but I am quite happy to edit the PHP if that is needed.

    Many thanks

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

  • Robin W
    Moderator

    @robin-w

    which plugin are you referring to? That would be a good starter


    assylumn
    Participant

    @assylumn

    Hi,

    The plugin I am referring to is this one:

    http://wordpress.org/plugins/bbpress-topic-thumbnails/

    The issue is that this one only pulls the thumbnail from the first image in the post. I want a default image to be used for all posts regardless so that the branding of the site remains consistent.

    There must be a way to do this through PHP, just I do not know where to start (and I have a limited knowledge of PHP).

    Cheers


    Robin W
    Moderator

    @robin-w

    Ok, I cracked that code open, and think that putting in the following will work

    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>');
    	}
    
    

    Obviously you’ll need to change the URL to your image

    You’ll need to add this to your functions file, if you don’t know how to do this, come back !


    assylumn
    Participant

    @assylumn

    Thank you for your swift response!

    I assume you mean the functions.php file within my template? If so, is there any particular point that I should insert the function?

    I have a site to deploy tomorrow so will look at this after I have done that and report back.

    Thanks again


    Robin W
    Moderator

    @robin-w

    Yes, No particular point that you should insert it – I’d put it at the end.


    assylumn
    Participant

    @assylumn

    Hi Robin,

    That has worked but with a small issue….the image is displaying far bigger than the uploaded file which is 75x75px. What do I need to change in that code to help the formatting?

    http://techdev.kemikalkitchen.co.uk/forums/forum/android/

    This is on my test server but is the same environment that the final site will reside in.

    Many thanks


    assylumn
    Participant

    @assylumn

    Got it!

    Reduced the width from 100% to 25% and now it looks good.

    You sir, are a Gentleman!

    Many thanks for the assist!


    Robin W
    Moderator

    @robin-w

    Great, glad it all worked !

    If you’re not using a child theme, then any theme upgrade may overwrite your functions file, so keep a note of the final code you used, as you may need to add it back.

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

You must be logged in to reply to this topic.