Support » Plugin: WP-PostRatings » Solution to displaying thumbnails next to title

  • Resolved lildragn

    (@lildragn)


    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/

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Solution to displaying thumbnails next to title’ is closed to new replies.