WordPress.org

Plugin Directory

Changeset 392384


Ignore:
Timestamp:
06/02/11 17:12:41 (3 years ago)
Author:
sivel
Message:

If smart loading is disabled, just hook into the_content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shadowbox-js/trunk/inc/frontend.php

    r391939 r392384  
    4040            // Automatically add Shadowbox to links 
    4141            if ( $this->is_automatic ( 'any' ) ) { 
    42                 add_filter ( 'the_posts' , array ( &$this , 'process_posts_early' ) , 10 , 2 ); 
     42                if ( $this->get_option ( 'smartLoad' ) == 'false' ) 
     43                    add_filter ( 'the_content', array ( &$this, 'add_attr_to_link' ) , 12 , 2 ); 
     44                else 
     45                    add_filter ( 'the_posts' , array ( &$this , 'process_posts_early' ) , 10 , 2 ); 
    4346                add_filter ( 'wp_get_attachment_link' , array ( &$this , 'add_attr_to_link' ) , 12 , 2 ); 
    4447            } 
     
    254257 
    255258        // Set the album ID, if the image is coming from a gallery use the gallery ID, otherwise use the ID of the post 
    256         if ( is_object( $post_or_id ) ) { 
     259        if ( is_object ( $post_or_id ) ) { 
    257260            $albumid = "sbpost-{$post_or_id->ID}"; 
    258         } elseif ( is_int( $post_or_id ) && $post_or_id != 0 ) { 
     261        } elseif ( is_int ( $post_or_id ) && $post_or_id != 0 ) { 
    259262            $p = get_post ( $post_or_id ); 
    260263            $albumid = "sbalbum-{$p->post_parent}"; 
    261264        } else { 
    262             $albumid = "sbgroup-" . time(); 
     265            global $post; 
     266            if ( isset ( $post) && is_object ( $post ) && is_int ( $post->ID ) ) 
     267                $albumid = "sbpost-{$post->ID}"; 
     268            else 
     269                $albumid = "sbgroup-" . time(); 
    263270        } 
    264271 
Note: See TracChangeset for help on using the changeset viewer.