• Trying to display popular posts pulling from the featured image I have set for each post. I have the thumbnails function enabled in my functions.php and it is set to hard crop thumbnail images to a square size. However, wpp seems to pull the Medium size image, which is not square, and then shrinks it down to the width I have set in the widget. So instead of having a row of nice square images, I have a row of images all the same width, but varying heights depending on the height of the original image.

    I do not want to use the timthumb script, but I cannot seem to get the usergenerated thumbnails to pull correctly from the hard cropped featured image.

Viewing 10 replies - 1 through 10 (of 10 total)
  • We are experiencing the same issue at PixelTango. Take a look at this screen-shot, where the bottom right thumbnail is not working properly.

    Here’s the code we use to output the images:
    wpp_get_mostpopular('limit=12&range=monthly&order_by=views&pages=0&thumbnail_selection=usergenerated&thumbnail_width=115&thumbnail_height=115&header_start="<h5><span>"&header_end="</span></h5>"&stats_comments=0&stats_views=0&do_pattern=1&pattern_form="{image}"');

    Any help or suggestions would be appreciated.

    Yeah I have the same issue it seems that if you leave the widget to get the images by itself them the default image show up. But if you use the set images tab then the images show up but there sizes are all wrong. Can there be a fix for this please or at least a work around.

    Here’s what we did over at PixelTango.

    In functions.php:

    function popularPosts($num) {
        global $wpdb;
    	$mpQuery = "SELECT $wpdb->posts.ID, $wpdb->posts.post_name, $wpdb->posts.post_title, SUM(pageviews) AS pageviews FROM $wpdb->posts LEFT JOIN wp_popularpostsdatacache ON $wpdb->posts.ID = wp_popularpostsdatacache.id WHERE (day >= '" .gmdate("Y-m-d"). "' - INTERVAL 30 DAY) GROUP BY id ORDER BY pageviews DESC LIMIT " . $num . "";
    	$mostpopular = $wpdb->get_results($mpQuery);
        return $mostpopular;
    }

    And in our theme we use this with a regular wordpress loop like so:

    <ul class="sq-list">
        <?php $popular = popularPosts(16); foreach ($popular as $post) : setup_postdata($post); ?>
            <li><a title="<?php the_title(); ?>" href="<?php echo get_permalink($post->id); ?>"><?php the_post_thumbnail( 'post-tn-square', array( 'alt' => the_title( '', false, '' ), 'title' => the_title( '', false, '' ) ) ); ?></a></li>
        <?php endforeach; ?>
    </ul>

    Please note: I am in no way a good PHP-developer, so use this code with caution lol… Hopefully this is useful for someone!

    Thread Starter purrdesign

    (@purrdesign)

    Thanks Miickel! That code worked beautifully. 🙂

    Thread Starter purrdesign

    (@purrdesign)

    Maybe I spoke too soon. Popular posts display perfectly, but the permalinks are not working (they’re trying to link to the 1970 version of the posts).

    Any ideas?

    Thread Starter purrdesign

    (@purrdesign)

    Got it.

    To fix this problem, and have this plugin pull the featured image you have selected for a post, edit the wordpress-popular-posts.php file. On line 703 you’ll see the output for the user-selected thumbnails. Change:

    array($tbWidth)

    to

    ‘thumbnail’

    (or replace thumbnail with whatever the name of the featured image size you want to use.)

    @ Purrdesign,

    I am finding your running commenter very interesting, has it all gone well now? Just a few question about your fix:

    – Does your latest fix still require all the code provided by ‘miickel’?
    – When you say replace ‘array($tbWidth)’ with ‘thumbnail’ do you literal mean replace it or just ‘$tbWidth’? also do you need to use the quote marks around thumbnail?

    Cheers hope to hear form you.

    Thread Starter purrdesign

    (@purrdesign)

    leehalliday –

    No, this fix is completely separate from what miickel posted (which didn’t work for me, couldn’t get the permalinks would work). So I took a closer look at the plugin’s code and figured out how to get it to pull the correct thumbnail.

    replace array($tbWidth) [no quotes in the actual code] with ‘thumbnail’ [single quotes included].

    Howdy,

    Well this is very close to what I need however there is still a small issue with I put ‘thumbnail’ and set the widget to select own images then they all appear 150px by 150px which is sort of what I want but 30px x 30px. Also If I change ‘thumbnail’ to ’30’ then the images appear but at there actually size which can be huge.

    So can you help in getting them to 30 x 30 please?

    Lee

    There no help for my issues, this makes me a sad panda!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WordPress Popular Posts] User Generated Thumbnails incorrect size’ is closed to new replies.