Plugin Directory

Changeset 708256


Ignore:
Timestamp:
05/05/2013 05:07:02 PM (13 years ago)
Author:
TM3909
Message:

Fixed how we are finding an image for pinterest.

Location:
wpsocialite/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wpsocialite/trunk/Socialite/extensions/socialite.stumbleupon.js

    r702809 r708256  
    4141        {
    4242
    43             console.log(instance);
    4443            var el = document.createElement('su:badge');
    4544            Socialite.copyDataAttributes(instance.el, el);
     
    4746            el.setAttribute('layout', instance.el.dataset.layout);
    4847            el.setAttribute('location', instance.el.dataset.url);
    49             console.log(el);
    5048            instance.el.appendChild(el);
    5149            if (typeof window.STMBLPN === 'object' && typeof window.STMBLPN.parse === 'function') {
  • wpsocialite/trunk/readme.txt

    r702809 r708256  
    8989== Changelog ==
    9090
     91= 2.3 May 5, 2013 =
     92* Fixed image function when using Pinit Button
     93
    9194= 2.2 April 24, 2013 =
    9295* Added StumbleUpon Social Sharing Button
     
    138141== Upgrade Notice ==
    139142
     143= 2.3 May 5, 2013 =
     144* Fixed image function when using Pinit Button
     145
    140146= 2.2 April 24, 2013 =
    141147* Added StumbleUpon Social Sharing Button
  • wpsocialite/trunk/wpsocialite.php

    r702809 r708256  
    55Description: No one likes long load times! Yet we all want to be able to share our content via Facebook, Twitter, and all other social networks. These take a long time to load. Paradox? Not anymore! With WPSocialite (utilizing David Bushnell's amazing SocialiteJS plugin [http://www.socialitejs.com/]) we can manage the loading process of our social sharing links. Load them on hover, on page scroll, and more!
    66Author: Tom Morton
    7 Version: 2.2
     7Version: 2.3
    88Author URI: http://twmorton.com/
    99
     
    154154            $post       = $wp_query->post;
    155155            $id         = $post->ID;
    156             $imagelink  = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'full' ); //get the featured image url
     156            $imagelink  = self::wpsocialite_get_image( $id );
    157157            $title      = trim($post->post_title);
     158
    158159            if( $url ){
    159160                $postlink   = $url;
     
    163164
    164165            $value      = get_option('wpsocialite_networkoptions');
    165             $buttons    = self::wpsocialite_list_network_options($postlink, $title, $size, $imagelink[0]);
     166            $buttons    = self::wpsocialite_list_network_options($postlink, $title, $size, $imagelink);
    166167
    167168            $return = '<ul class="wpsocialite social-buttons '.$size.'">';
     
    185186            return $return;
    186187
     188        }
     189
     190        public function wpsocialite_get_image( $postID ) {
     191            //try the featured image first
     192            if(has_post_thumbnail()){
     193                $imageattachment = wp_get_attachment_image_src( get_post_thumbnail_id( $postID ), 'full' );
     194                $imagelink = $imageattachment[0];
     195            } else {
     196            //No featured image? Try for an attachment.
     197                $args = array(
     198                    'order'          => 'ASC',
     199                    'post_parent'    => $postID,
     200                    'post_type'      => 'attachment',
     201                    'post_mime_type' => 'image',
     202                    'post_status'    => null,
     203                    'showposts'      => '1',
     204                );
     205                $attachments = get_posts($args);
     206                if ($attachments) {
     207                    foreach ($attachments as $attachment) {
     208                        $imagelink = wp_get_attachment_url($attachment->ID, 'full', false, false);
     209                    }
     210                } else{
     211                    $imagelink = null; //if there are no attachments set $imagelink to null
     212                }
     213            }
     214            return $imagelink;
    187215        }
    188216
Note: See TracChangeset for help on using the changeset viewer.