WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] Solution to displaying thumbnails next to title (6 posts)

  1. lildragn
    Member
    Posted 1 year ago #

    Hi, just in case anyone wanted to do this (I know there is but no easy solutions until now)

    Yes you can display the thumbnail next to the title like so

    View example

    Easiest solution I found after hours of trying is to open wp-postratings.php and look for code block

    if (strpos($template, '%POST_CONTENT%') !== false) {
    		if ($post->ID != $post_id) {
    			$post = &get_post($post_id);
    		}
    		$value = str_replace("%POST_CONTENT%", get_the_content(), $value);
    	}

    Around line 1209-1214

    After that block add something similar (I'm grabbing my featured image thumb here)

    if (strpos($template, '%THUMBNAIL%') !== false) {
    		if ($post->ID != $post_id) {
    			$post = &get_post($post_id);
    		}
    		$value = str_replace("%THUMBNAIL%", get_the_post_thumbnail($post->ID, 'thumbnail'), $value);
    	}

    Now in the Ratings Templates setting in the admin section of WP add this line to whichever template you're using

    <a href="%POST_URL%">%THUMBNAIL%</a>

    And that should do it. Let me know if you have any questions and I'll do my best to answer them.

    Cheers!

    http://wordpress.org/extend/plugins/wp-postratings/

  2. Subseven
    Member
    Posted 10 months ago #

    Hey, for my site I'm using a woothemes theme. I use Video-thumbnails to automatically create a featured image. The code is not working for me, all it displays it %Thumbnail%. What can I do to fix this?

  3. oremele
    Member
    Posted 7 months ago #

    Works fine! Thanks. Gracias amigo

  4. free2khaja
    Member
    Posted 5 months ago #

    Works Fine. Thank you.

  5. kraket3
    Member
    Posted 4 months ago #

    Thanks! This works great except the thumbnails are quite big for the widget, is there any way to make them smaller?

    Would be greatly appreciated!

  6. free2khaja
    Member
    Posted 4 months ago #

    Hello Kraket3,

    Please change your css with height & width what ever image size you want.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags