Viewing 9 replies - 1 through 9 (of 9 total)
  • In the google-analytics-top-posts-widget.php file there is the following code:

    $list .= apply_filters( 'gtc_list_item', '<li><a href="'. $url .'">' . $title . '</a></li>', $page, $wppost, $counter );

    Wouldn’t changing this to something like the following produce the thumbnail:

    $list .= apply_filters( 'gtc_list_item', '<li><code to generate thumbnail><a href="'. $url .'">' . $title . '</a></li>', $page, $wppost, $counter );

    Perhaps someone with better coding abilities could shed some light on this?

    For anyone else wondering: I found a solution to include thumbnails. Got it working by retrieving the post ID from the URL of the posts.

    Replace this (around line 268):

    $list .= apply_filters( 'gtc_list_item', '<li><a href="'. $url .'">' . $title . '</a></li>', $page, $wppost, $counter );

    By something like this:

    $thumb_post = url_to_postid( $url );
    $featured_image = get_the_post_thumbnail($thumb_post, 'small');
    
    $list .= apply_filters( 'gtc_list_item', '<li>' . $featured_image . ' <a href="'. $url .'">' . $title . '</a></li>', $page, $wppost, $counter );

    That will generate the thumbnails. Might not be the most solid way to do things, but it works.

    Thanks, Jildert.

    Thanks for sharing Jildert.

    Thinking out loud: this would perhaps be a great feature for the original plugin? 🙂

    Is there a way to put this in functions.php in child theme instead of overrinding core files?

    as of v1.5.5 it is line 283.

    it would be really good if author can include this functionality. ability to choose thumbnail size.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    With version 1.5.6, your wait is over. You should see the upgrade notice in your dashboards today.

    Also, I highly discourage hacking plugin files… You’ll lose all the modifications when there is a plugin update available.

    i am recieveing the following problem. i have set the thumbnail etc in the widget

    [12-Jan-2015 10:56:46 UTC] PHP Strict Standards:  Non-static method SimpleFileCache::isExpired() should not be called statically, assuming $this from incompatible context in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-dashboard/ga-lib.php on line 245
    [12-Jan-2015 10:56:47 UTC] PHP Strict Standards:  Non-static method SimpleFileCache::cachePut() should not be called statically, assuming $this from incompatible context in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-dashboard/ga-lib.php on line 315
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 265
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 276
    [12-Jan-2015 10:56:47 UTC] PHP Notice:  Trying to get property of non-object in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/google-analytics-top-posts-widget.php on line 278

    I use transient cleaner to clear the cache, and amr shortocde widget to get the info on the page.

    I also see

    [12-Jan-2015 11:00:03 UTC] PHP Strict Standards:  Declaration of TGM_Bulk_Installer_Skin::before() should be compatible with Bulk_Upgrader_Skin::before($title = '') in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/class-tgm-plugin-activation.php on line 1891
    [12-Jan-2015 11:00:03 UTC] PHP Strict Standards:  Declaration of TGM_Bulk_Installer_Skin::after() should be compatible with Bulk_Upgrader_Skin::after($title = '') in /opt/new-website/httpdocs/wp-content/plugins/google-analytics-top-posts-widget/class-tgm-plugin-activation.php on line 1891

    in 1.5.5 I was able to hardcode them in div tags style layout. also display custom image for posts that do not have a feature image. is there anyway i can do this on 1.5.6?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Anyway to Include Thumbnail Images’ is closed to new replies.