WordPress.org

Plugin Directory

Changeset 633817


Ignore:
Timestamp:
12/04/12 04:08:21 (17 months ago)
Author:
mitchoyoshitaka
Message:

define yarpp-thumbnail size if not already defined by theme

Location:
yet-another-related-posts-plugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • yet-another-related-posts-plugin/trunk/class-admin.php

    r633252 r633817  
    2323            exit; 
    2424        } 
    25          
    26         //add_image_size( 'yarpp-thumbnail', $width, $height, $crop ); 
    2725         
    2826        add_action( 'admin_init', array( $this, 'ajax_register' ) ); 
  • yet-another-related-posts-plugin/trunk/class-core.php

    r633784 r633817  
    4444        add_filter( 'the_content_feed', array( $this, 'the_content_feed' ), 600 ); 
    4545        add_filter( 'the_excerpt_rss', array( $this, 'the_excerpt_rss' ), 600 ); 
     46 
     47        // register yarpp-thumbnail size, if theme has not already 
     48        // @todo: make these UI-configurable? 
     49        if ( false === $this->thumbnail_size() ) { 
     50            $width = 120; 
     51            $height = 120; 
     52            $crop = true; 
     53            add_image_size( 'yarpp-thumbnail', $width, $height, $crop ); 
     54        } 
    4655 
    4756        if ( isset($_REQUEST['yarpp_debug']) ) 
     
    284293    } 
    285294     
     295    function thumbnail_size() { 
     296        global $_wp_additional_image_sizes; 
     297        if ( !isset($_wp_additional_image_sizes['yarpp-thumbnail']) ) 
     298            return false; 
     299        return $_wp_additional_image_sizes['yarpp-thumbnail']; 
     300    } 
     301     
    286302    /* 
    287303     * UPGRADE ROUTINES 
Note: See TracChangeset for help on using the changeset viewer.