Plugin Directory

Changeset 771371


Ignore:
Timestamp:
09/13/2013 04:07:43 AM (12 years ago)
Author:
cochran
Message:

Added: All images sizes are now available for thumbnails. Updated: More code clean up. Fixed: Fatal error when using JetPack Mobile theme. Extra checks to make sure Genesis is active before running code.

Location:
genesis-post-teasers/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • genesis-post-teasers/trunk/css/teaserstyles.php

    r766525 r771371  
    55$height = "auto";
    66
    7 if ( $_GET['genesisopt_no_pair'] )
     7if ( isset( $_GET['genesisopt_no_pair'] ) )
    88    $width = 'auto';
    99
    10 if ( $_GET['genesisopt_width'] && $_GET['genesisopt_enable_custom_styles'] )
     10if ( isset( $_GET['genesisopt_width'] ) && isset( $_GET['genesisopt_enable_custom_styles'] ) )
    1111    $width = $_GET['genesisopt_width'] . "px";
    1212
    13 if ( $_GET['genesisopt_height'] && $_GET['genesisopt_enable_custom_styles'] )
     13if ( isset( $_GET['genesisopt_height'] ) && isset( $_GET['genesisopt_enable_custom_styles'] ) )
    1414    $height = $_GET['genesisopt_height'] . "px";
    1515
     
    4040<?php
    4141
    42 if ( $_GET['genesisopt_no_pair'] && $_GET['genesisopt_enable_custom_styles'] ) { ?>
     42if ( isset( $_GET['genesisopt_no_pair'] ) && isset( $_GET['genesisopt_enable_custom_styles'] ) ) { ?>
    4343
    4444    #post-teasers .genesis-grid-odd {
     
    5151    }
    5252
    53 <?php } elseif ( $_GET['genesisopt_no_pair'] && ! $_GET['genesisopt_enable_custom_styles'] ) { ?>
     53<?php } elseif ( isset( $_GET['genesisopt_no_pair'] ) && ! isset( $_GET['genesisopt_enable_custom_styles'] ) ) { ?>
    5454
    5555    #post-teasers .genesis-grid,
  • genesis-post-teasers/trunk/genesis-post-teasers.php

    r766525 r771371  
    44Plugin URI: http://genesistutorials.com/plug-ins/genesis-post-teasers/
    55Description: Add theme settings for enabling teasers for the Genesis Theme Framework by studiopress. Uses genesis_grid_loop();
    6 Version: 2.0.1
     6Version: 2.0.2
    77Author: Christopher Cochran
    88Author URI: http://christophercochran.me
     
    4040        if ( ! in_array( $theme_info->Template, $genesis_flavors ) ) {
    4141            deactivate_plugins( plugin_basename(__FILE__) ); // Deactivate ourself
    42             wp_die('Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>');
     42            wp_die( 'Sorry, you are not able to activate this plugin unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>' );
    4343        }
    4444
     
    107107    public function enable_logic() {
    108108
    109         if ( function_exists('genesis') ) {
    110 
    111             $this->full_posts   = genesis_get_option( 'numof_full_posts' );
    112             $this->teaser_posts = $this->posts_size() - $this->full_posts;
    113 
    114             if ( $this->teasers_on ) {
    115 
    116                 remove_action( 'genesis_loop', 'genesis_do_loop' );
    117                 remove_action( 'genesis_loop', 'focus_grid_loop_helper' );
    118                 remove_action( 'genesis_loop', 'pretty_grid_loop_helper' );
    119 
    120                 add_action( 'genesis_loop', array( &$this, 'grid_loop' ) );
    121 
    122                 add_action( 'genesis_before_post', array( &$this, 'container_open' ), 1 );
     109        if ( ! function_exists( 'genesis' ) )
     110            return;
     111
     112        $this->full_posts   = genesis_get_option( 'numof_full_posts' );
     113        $this->teaser_posts = $this->posts_size() - $this->full_posts;
     114
     115        if ( $this->teasers_on ) {
     116
     117            remove_action( 'genesis_loop', 'genesis_do_loop' );
     118            remove_action( 'genesis_loop', 'focus_grid_loop_helper' );
     119            remove_action( 'genesis_loop', 'pretty_grid_loop_helper' );
     120
     121            add_action( 'genesis_loop', array( &$this, 'grid_loop' ) );
     122
     123            add_action( 'genesis_before_post', array( &$this, 'container_open' ), 1 );
     124
     125            // HTML5
     126            add_action( 'genesis_before_entry', array( &$this, 'container_open' ), 10 );
     127
     128            if ( genesis_get_option( 'no_pair_teasers' ) == 0 ) {
     129
     130                add_action( 'genesis_before_post',    array( &$this, 'row_wrap_open'        ), 5  );
     131                add_action( 'genesis_after_post',     array( &$this, 'row_wrap_closeopen'   ), 15 );
     132                add_action( 'genesis_after_post',     array( &$this, 'row_wrap_close'       ), 15 );
    123133
    124134                // HTML5
    125                 add_action( 'genesis_before_entry', array( &$this, 'container_open' ), 10 );
    126 
    127                 if ( genesis_get_option('no_pair_teasers') == 0 ) {
    128 
    129                     add_action( 'genesis_before_post',    array( &$this, 'row_wrap_open'        ), 5  );
    130                     add_action( 'genesis_after_post',     array( &$this, 'row_wrap_closeopen'   ), 15 );
    131                     add_action( 'genesis_after_post',     array( &$this, 'row_wrap_close'       ), 15 );
    132 
    133                     // HTML5
    134                     add_action( 'genesis_before_entry',    array( &$this, 'row_wrap_open'       ), 15 );
    135                     add_action( 'genesis_after_entry',     array( &$this, 'row_wrap_closeopen'  )     );
    136                     add_action( 'genesis_after_entry',     array( &$this, 'row_wrap_close'      )     );
    137 
    138                 }
    139 
    140                 add_action( 'genesis_after_endwhile', array( &$this, 'container_close' ), 1 );
    141 
    142                 if ( genesis_get_option('no_pair_teasers') == 1 || genesis_get_option('use_css') == 'pluginstyles'  ) {
    143 
    144                     $genesis                         = $this->full_posts;
    145                     $genesisopt_full_width           = genesis_get_option( 'no_pair_teasers'             );
    146                     $genesisopt_width                = genesis_get_option( 'post_teaser_width'           );
    147                     $genesisopt_height               = genesis_get_option( 'post_teaser_height'          );
    148                     $genesisopt_enable_custom_styles = genesis_get_option( 'enable_custom_teaser_styles' );
    149 
    150                     wp_enqueue_style(
    151                         'teaserstyles',
    152                         WP_PLUGIN_URL . "/genesis-post-teasers/css/teaserstyles.php?genesis=$genesis&genesisopt_width=$genesisopt_width&genesisopt_height=$genesisopt_height&genesisopt_no_pair=$genesisopt_full_width&genesisopt_enable_custom_styles=$genesisopt_enable_custom_styles"
    153                     );
    154 
    155                 }
    156 
    157                 if ( genesis_get_option('disable_teaser_meta') == 1 ) {
    158 
    159                     remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
    160 
    161                     add_action( 'genesis_after_post_content', array( &$this, 'post_meta_logic' ) );
    162 
    163 
    164                     // HTML5
    165                     remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    166 
    167                     add_action( 'genesis_entry_footer', array( &$this, 'post_meta_logic' ) );
    168 
    169                 }
    170 
    171                 if ( genesis_get_option( 'disable_teaser_info' ) == 1 ) {
    172 
    173                     remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    174 
    175                     add_action( 'genesis_before_post_content', array( &$this, 'post_info_logic' ) );
    176 
    177 
    178                     // HTML5
    179                     remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    180 
    181                     add_action( 'genesis_entry_header', array( &$this, 'post_info_logic' ), 12 );
    182 
    183                 }
     135                add_action( 'genesis_before_entry',    array( &$this, 'row_wrap_open'       ), 15 );
     136                add_action( 'genesis_after_entry',     array( &$this, 'row_wrap_closeopen'  )     );
     137                add_action( 'genesis_after_entry',     array( &$this, 'row_wrap_close'      )     );
     138
     139            }
     140
     141            add_action( 'genesis_after_endwhile', array( &$this, 'container_close' ), 1 );
     142
     143            if ( genesis_get_option( 'no_pair_teasers' ) == 1 || genesis_get_option( 'use_css' ) == 'pluginstyles'  ) {
     144
     145                $genesis                         = $this->full_posts;
     146                $genesisopt_full_width           = genesis_get_option( 'no_pair_teasers'             );
     147                $genesisopt_width                = genesis_get_option( 'post_teaser_width'           );
     148                $genesisopt_height               = genesis_get_option( 'post_teaser_height'          );
     149                $genesisopt_enable_custom_styles = genesis_get_option( 'enable_custom_teaser_styles' );
     150
     151                wp_enqueue_style(
     152                    'teaserstyles',
     153                    WP_PLUGIN_URL . "/genesis-post-teasers/css/teaserstyles.php?genesis=$genesis&genesisopt_width=$genesisopt_width&genesisopt_height=$genesisopt_height&genesisopt_no_pair=$genesisopt_full_width&genesisopt_enable_custom_styles=$genesisopt_enable_custom_styles"
     154                );
     155
     156            }
     157
     158            if ( genesis_get_option( 'disable_teaser_meta' ) == 1 ) {
     159
     160                remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
     161
     162                add_action( 'genesis_after_post_content', array( &$this, 'post_meta_logic' ) );
     163
     164
     165                // HTML5
     166                remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
     167
     168                add_action( 'genesis_entry_footer', array( &$this, 'post_meta_logic' ) );
     169
     170            }
     171
     172            if ( genesis_get_option( 'disable_teaser_info' ) == 1 ) {
     173
     174                remove_action( 'genesis_before_post_content', 'genesis_post_info' );
     175
     176                add_action( 'genesis_before_post_content', array( &$this, 'post_info_logic' ) );
     177
     178
     179                // HTML5
     180                remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
     181
     182                add_action( 'genesis_entry_header', array( &$this, 'post_info_logic' ), 12 );
    184183
    185184            }
     
    266265
    267266    function query( $query ) {
     267
     268        if ( ! function_exists( 'genesis_get_option' ) )
     269            return;
    268270
    269271        if ( genesis_get_option( 'teasers_enable' ) == 'Home Page' )
     
    297299
    298300        if ( genesis_get_option( 'enable_teaser_thumbnail' ) )
    299             $grid_image_size = genesis_get_option('teaser_thumbnail_size');
     301            $grid_image_size = genesis_get_option( 'teaser_thumbnail_size' );
    300302
    301303        if ( genesis_get_option( 'readmore_link_on_teasers' ) )
     
    329331        }
    330332
    331         if ( genesis_get_option('teasers_enable') == 'Archives' ) {
     333        if ( genesis_get_option( 'teasers_enable' ) == 'Archives' ) {
    332334
    333335            $cat_id = get_query_var( 'cat' );
  • genesis-post-teasers/trunk/gpt-meta-box.php

    r765337 r771371  
    4545<p style="padding-left: 20px;" class="select-feat-image-size <?php if ( genesis_get_option('gpt_enable_featured_thumbnail') == '' ) echo 'hidden' ?>">
    4646    <?php _e("Image Size", 'genesis'); ?>:
    47     <?php $sizes = genesis_get_additional_image_sizes(); ?>
     47    <?php $sizes = genesis_get_image_sizes(); ?>
    4848    <select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[gpt_thumbnail_featured_size]">
    4949        <option style="padding-right:10px;" value="thumbnail">thumbnail (<?php echo get_option('thumbnail_size_w'); ?>x<?php echo get_option('thumbnail_size_h'); ?>)</option>
     
    6161<p style="padding-left: 20px;" class="select-image-size <?php if ( genesis_get_option('enable_teaser_thumbnail') == '' ) echo 'hidden' ?>">
    6262    <?php _e("Image Size", 'genesis'); ?>:
    63     <?php $sizes = genesis_get_additional_image_sizes(); ?>
     63    <?php $sizes = genesis_get_image_sizes(); ?>
    6464    <select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[teaser_thumbnail_size]">
    6565        <option style="padding-right:10px;" value="thumbnail">thumbnail (<?php echo get_option('thumbnail_size_w'); ?>x<?php echo get_option('thumbnail_size_h'); ?>)</option>
  • genesis-post-teasers/trunk/js/settingslide.js

    r415099 r771371  
    11jQuery(document).ready(function($) {
    2    
    3     jQuery("#gPostTeaz-settings-box input:radio:checked").live('load change', function() {
    4        
    5         if ( jQuery(this).val() == 'stylesheet' ) {
    6             jQuery("#gPostTeaz-settings-box .css-opts").hide('fast');
     2
     3    $("#gPostTeaz-settings-box input:radio:checked").live('load change', function() {
     4
     5        if ( $(this).val() == 'stylesheet' ) {
     6            $("#gPostTeaz-settings-box .css-opts").hide('fast');
    77        }
    8        
    9         if ( jQuery(this).val() != 'stylesheet' ) {
    10             jQuery("#gPostTeaz-settings-box .css-opts").show('fast');
     8
     9        if ( $(this).val() != 'stylesheet' ) {
     10            $("#gPostTeaz-settings-box .css-opts").show('fast');
    1111        }
    12        
     12
    1313    });
    14    
    15     jQuery("#gPostTeaz-settings-box .css-opts input[type='checkbox']").live('load change', function() {
    16        
    17         if ( jQuery(this).is(':checked')) {
    18             jQuery("#gPostTeaz-settings-box .custom-css-opts").show('fast');
    19         } else {   
    20             jQuery("#gPostTeaz-settings-box .custom-css-opts").hide('fast');
     14
     15    $("#gPostTeaz-settings-box .css-opts input[type='checkbox']").live('load change', function() {
     16
     17        if ( $(this).is(':checked') ) {
     18            $("#gPostTeaz-settings-box .custom-css-opts").show('fast');
     19        } else {
     20            $("#gPostTeaz-settings-box .custom-css-opts").hide('fast');
    2121        }
    22        
     22
    2323    });
    24    
    25     jQuery("#gPostTeaz-settings-box .enable-thumbnail input[type='checkbox']").live('load change', function() {
    26        
    27         if ( jQuery(this).is(':checked')) {
    28             jQuery("#gPostTeaz-settings-box .select-image-size").show('fast');
    29         } else {   
    30             jQuery("#gPostTeaz-settings-box .select-image-size").hide('fast');
     24
     25    $("#gPostTeaz-settings-box .enable-thumbnail input[type='checkbox']").live('load change', function() {
     26
     27        if ( $(this).is(':checked') ) {
     28            $("#gPostTeaz-settings-box .select-image-size").show('fast');
     29        } else {
     30            $("#gPostTeaz-settings-box .select-image-size").hide('fast');
    3131        }
    32        
     32
    3333    });
    34    
    35     jQuery("#gPostTeaz-settings-box .enable-feat-thumbnail input[type='checkbox']").live('load change', function() {
    36        
    37         if ( jQuery(this).is(':checked')) {
    38             jQuery("#gPostTeaz-settings-box .select-feat-image-size").show('fast');
    39         } else {   
    40             jQuery("#gPostTeaz-settings-box .select-feat-image-size").hide('fast');
     34
     35    $("#gPostTeaz-settings-box .enable-feat-thumbnail input[type='checkbox']").live('load change', function() {
     36
     37        if ( $(this).is(':checked') ) {
     38            $("#gPostTeaz-settings-box .select-feat-image-size").show('fast');
     39        } else {
     40            $("#gPostTeaz-settings-box .select-feat-image-size").hide('fast');
    4141        }
    42        
     42
    4343    });
    44    
    45    
     44
     45
    4646});
    4747
    4848function genesis_confirm( text ) {
    4949    var answer = confirm( text );
    50    
     50
    5151    if( answer ) { return true; }
    5252    else { return false; }
  • genesis-post-teasers/trunk/readme.txt

    r766525 r771371  
    3737== Changelog ==
    3838
     39= 2.0.2 =
     40* Added: All images sizes are now available for thumbnails.
     41* Updated: More code clean up.
     42* Fixed: Fatal error when using JetPack Mobile theme. Extra checks to make sure Genesis is active before running code.
     43
    3944= 2.0.1 =
    40 Fixed: Some themes may override "Do not show teasers in pairs" by using included theme styles. Added Styles to override floating of teasers when "Do not show teasers in pairs" is checked.
     45* Fixed: Some themes may override "Do not show teasers in pairs" by using included theme styles. Added Styles to override floating of teasers when "Do not show teasers in pairs" is checked.
    4146
    4247= 2.0.0 =
Note: See TracChangeset for help on using the changeset viewer.