Plugin Directory

Changeset 903726


Ignore:
Timestamp:
04/27/2014 11:43:24 PM (12 years ago)
Author:
terminalpixel
Message:

Add better support for non post object based pages

Location:
developer-share-buttons/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • developer-share-buttons/trunk/developer-share-buttons.php

    r903694 r903726  
    33Plugin Name: Developer Share Buttons
    44Description: Share buttons with no CSS and no JavaScript
    5 Version: 1.0.3
     5Version: 1.0.4
    66Author: Terminal Pixel
    77Author URI: http://wwww.terminalpixel.co.uk/
     
    214214                    $css_class = static::$slug;
    215215
    216                     if ( !$title && !$url )
    217                         $title = get_the_title();
    218 
    219                     if ( !$url )
    220                         $url = get_permalink();
    221 
    222                     if ( $service['url_after_title'] && $title )
     216                    // If the page is not a proper post object fall back to defaults
     217                    if ( get_post() ) {
     218
     219                        if ( !$title && !$url ) {
     220                            $title = get_the_title();
     221                        }
     222
     223                        if ( !$url ) {
     224                            $url = get_permalink();
     225                        }
     226
     227
     228                        if ( !$image && $image_id = get_post_thumbnail_id() ) {
     229                            $image_object = wp_get_attachment_image_src( $image_id, 'full' );
     230                            $image = $image_object[0];
     231                        }
     232
     233                    } else {
     234
     235                        $title = get_bloginfo( 'title' );
     236                        $url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ;
     237
     238                    }
     239
     240                    if ( $service['url_after_title'] && $title ) {
    223241                        $title .= ' ' . $url;
     242                    }
    224243
    225244                    $url = urlencode( $url );
    226 
    227                     if ( !$image && $image_id = get_post_thumbnail_id() ) {
    228                         $image_object = wp_get_attachment_image_src( $image_id, 'full' );
    229                         $image = $image_object[0];
    230                     }
    231245
    232246                    $share_text = apply_filters( static::$slug_ . '_share_text', $share_text );
  • developer-share-buttons/trunk/readme.txt

    r903694 r903726  
    44Requires at least: 3.5
    55Tested up to: 3.9
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77
    88A super lightweight social sharing solution. No JavaScript. No images. No CSS.
     
    6161= 1.0.3 =
    6262* Fix profile link widget
     63
     64= 1.0.4 =
     65* Improve support for non post object based pages
Note: See TracChangeset for help on using the changeset viewer.