Plugin Directory

Changeset 371658


Ignore:
Timestamp:
04/11/2011 06:13:06 PM (15 years ago)
Author:
cochran
Message:

Added ability to display teaser boxes on archives. Added default settings. Cleaned up settings widget. Fixed: Meta box didn't display in Genesis 1.6. Dropped Beta from version.

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

Legend:

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

    r371097 r371658  
    1 <?php header("Content-type: text/css");
     1<?php
     2header("Content-type: text/css");
    23
    3 if ( !$_GET['genesisopt_width'] ) {
    4     $width = 300px;
    5 }
     4$width = '48%';
     5
    66if ( $_GET['genesisopt_width']  && $_GET['genesisopt_no_pair'] == 0 ) {
    7     $width = $_GET['genesisopt_width'];
    8     $width .= "px";
     7$width = $_GET['genesisopt_width'];
     8$width .= "px";
    99}
    1010if ( $_GET['genesisopt_height'] == '' ) {
    11     $height = "auto";
     11$height = "auto";
    1212} else {
    13     $height = $_GET['genesisopt_height'];
    14     $height .= "px";
     13$height = $_GET['genesisopt_height'];
     14$height .= "px";
    1515}
    1616
    1717if ( $_GET['genesisopt_no_pair'] == 1 ) { ?>
    1818
    19     #post-teasers, .post-teasers-pair {
    20         clear:both;
    21     }
    22     #post-teasers .genesis-grid-even,
    23     #post-teasers .genesis-grid-odd {
    24         width:100%;
    25         float: none;
    26         height: auto;
    27     }
     19#post-teasers, .post-teasers-pair {
     20    clear:both;
     21}
     22#post-teasers .genesis-grid-even,
     23#post-teasers .genesis-grid-odd {
     24    width:100%;
     25    float: none;
     26    height: auto;
     27}
    2828
    2929<?php
  • genesis-post-teasers/trunk/genesis-post-teasers.php

    r371096 r371658  
    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: 1.0b
     6Version: 1.0
    77Author: Christopher Cochran
    88Author URI: http://christophercochran.me
     
    2020
    2121}
     22
     23add_filter('genesis_theme_settings_defaults', 'define_post_teasers_default_settings', 15, 2);
     24function define_post_teasers_default_settings($defaults) {
     25    $defaults = array(
     26        'teasers_enable' => 'Home Page',
     27        'numof_posts_per_page' => 10,
     28        'use_css' => 'pluginstyles',
     29        'numof_full_posts' => 2,
     30        'readmore_link_on_teasers' => '[Continue reading...]'
     31    );
     32    return $defaults;
     33}
     34
    2235
    2336$gPostTeaz_full = false;
     
    2639function enable_post_teaser_logic() {
    2740    if ( function_exists('genesis') ) {
    28         global $gPostTeaz_full;
     41    global $gPostTeaz_full;
     42   
     43        if( genesis_get_option('teasers_enable') == 'Home Page' )
     44            $enableteaserson = is_home();
     45        if( genesis_get_option('teasers_enable') == 'Blog Template' )
     46            $enableteaserson = is_page_template( 'page_blog.php' );
     47        if( genesis_get_option('teasers_enable') == 'Archives' )
     48            $enableteaserson = is_archive();
     49           
    2950        $gPostTeaz_full = genesis_get_option('numof_full_posts');
    30        
    31         if( genesis_get_option('teasers_enable') == 'Blog Template' ) {
    32             if ( is_page_template( 'page_blog.php' ) ) {
    33                 remove_action( 'genesis_loop', 'genesis_do_loop' );
    34                 remove_action( 'genesis_loop', 'focus_grid_loop_helper' );
    35                 remove_action( 'genesis_loop', 'pretty_grid_loop_helper' );
    36                 add_action( 'genesis_loop', 'gpt_grid_loop' );
    37                 add_action('genesis_before_post','post_teaser_do_open', 10, 2);
    38                 if( genesis_get_option('no_pair_teasers') == 0 ) {
    39                     add_action('genesis_before_post','post_teaser_pertwo_wrap_open', 15, 2);
    40                     add_action('genesis_after_post','post_teaser_pertwo_wrap_openclose');
    41                     add_action('genesis_after_endwhile','post_teaser_pertwo_wrap_close', 5, 2);
    42                 }
    43                 add_action('genesis_after_endwhile','post_teaser_do_close', 6, 2);
    44                 add_filter('genesis_options', 'define_content_archive_home_setting', 10, 2);
    45                 if( genesis_get_option('use_css') == 'pluginstyles' || genesis_get_option('no_pair_teasers') == 1 ) {
    46                     $genesis = $gPostTeaz_full;
    47                     $genesisopt_full_width = genesis_get_option('no_pair_teasers');
    48                     $genesisopt_width = genesis_get_option('post_teaser_width');
    49                     $genesisopt_height = genesis_get_option('post_teaser_height');
    50                     wp_enqueue_style('teaserstyles', 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");
    51                 }
    52                 if( genesis_get_option('disable_teaser_meta') == 1 ) {
    53                     remove_action('genesis_after_post_content', 'genesis_post_meta');
    54                     add_filter('genesis_after_post_content', 'genesis_post_meta_teaser_logic');
    55                 }
    56                 if( genesis_get_option( 'disable_teaser_info' ) == 1 ) {
    57                     remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    58                     add_filter( 'genesis_before_post_content', 'genesis_post_info_teaser_logic' );
    59                 }
    60             }
    61         }   
    62         if( genesis_get_option('teasers_enable') == 'Home Page' ) {
    63             if (is_home() ) {
    64                 remove_action( 'genesis_loop', 'genesis_do_loop' );
    65                 remove_action( 'genesis_loop', 'focus_grid_loop_helper' );
    66                 remove_action( 'genesis_loop', 'pretty_grid_loop_helper' );
    67                 add_action( 'genesis_loop', 'gpt_grid_loop' );
    68                 add_action('genesis_before_post','post_teaser_do_open', 10, 2);
    69                 if( genesis_get_option('no_pair_teasers') == 0 ) {
    70                     add_action('genesis_before_post','post_teaser_pertwo_wrap_open', 15, 2);
    71                     add_action('genesis_after_post','post_teaser_pertwo_wrap_openclose');
    72                     add_action('genesis_after_endwhile','post_teaser_pertwo_wrap_close', 5, 2);
    73                 }
    74                 add_action('genesis_after_endwhile','post_teaser_do_close', 6, 2);
    75                 add_filter('genesis_options', 'define_content_archive_home_setting', 10, 2);
    76                 if( genesis_get_option('use_css') == 'pluginstyles' || genesis_get_option('no_pair_teasers') == 1 ) {
    77                     $genesis = $gPostTeaz_full;
    78                     $genesisopt_full_width = genesis_get_option('no_pair_teasers');
    79                     $genesisopt_width = genesis_get_option('post_teaser_width');
    80                     $genesisopt_height = genesis_get_option('post_teaser_height');
    81                     wp_enqueue_style('teaserstyles', 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");
    82                 }
    83                 if( genesis_get_option('disable_teaser_meta') == 1 ) {
    84                     remove_action('genesis_after_post_content', 'genesis_post_meta');
    85                     add_filter('genesis_after_post_content', 'genesis_post_meta_teaser_logic');
    86                 }
    87                 if( genesis_get_option( 'disable_teaser_info' ) == 1 ) {
    88                     remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    89                     add_filter( 'genesis_before_post_content', 'genesis_post_info_teaser_logic' );
    90                 }
     51           
     52        if ( $enableteaserson ) {
     53            remove_action( 'genesis_loop', 'genesis_do_loop' );
     54            remove_action( 'genesis_loop', 'focus_grid_loop_helper' );
     55            remove_action( 'genesis_loop', 'pretty_grid_loop_helper' );
     56            add_action( 'genesis_loop', 'gpt_grid_loop' );
     57            add_action('genesis_before_post','post_teaser_do_open', 10, 2);
     58            if( genesis_get_option('no_pair_teasers') == 0 ) {
     59                add_action('genesis_before_post','post_teaser_pertwo_wrap_open', 15, 2);
     60                add_action('genesis_after_post','post_teaser_pertwo_wrap_openclose');
     61                add_action('genesis_after_endwhile','post_teaser_pertwo_wrap_close', 5, 2);
     62            }
     63            add_action('genesis_after_endwhile','post_teaser_do_close', 6, 2);
     64            add_filter('genesis_options', 'define_content_archive_home_setting', 10, 2);
     65            if( genesis_get_option('no_pair_teasers') == 1 || genesis_get_option('use_css') == 'pluginstyles'  ) {
     66                $genesis = $gPostTeaz_full;
     67                $genesisopt_full_width = genesis_get_option('no_pair_teasers');
     68                $genesisopt_width = genesis_get_option('post_teaser_width');
     69                $genesisopt_height = genesis_get_option('post_teaser_height');
     70                wp_enqueue_style('teaserstyles', 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");
     71            }
     72            if( genesis_get_option('disable_teaser_meta') == 1 ) {
     73                remove_action('genesis_after_post_content', 'genesis_post_meta');
     74                add_filter('genesis_after_post_content', 'genesis_post_meta_teaser_logic');
     75            }
     76            if( genesis_get_option( 'disable_teaser_info' ) == 1 ) {
     77                remove_action( 'genesis_before_post_content', 'genesis_post_info' );
     78                add_filter( 'genesis_before_post_content', 'genesis_post_info_teaser_logic' );
    9179            }
    9280        }
     
    196184// and to use teaser or not.
    197185// If enable teasers is not checked none the previous code will run.
    198 add_action('genesis_init', 'add_gPostTeaz_settings_init');
     186add_action('genesis_init', 'add_gPostTeaz_settings_init', 15 );
    199187function add_gPostTeaz_settings_init() {
    200 add_action('admin_menu', 'gPostTeaz_settings_init');
     188add_action('admin_menu', 'gPostTeaz_settings_init' );
    201189}
    202190
     
    216204global $_genesis_theme_settings_pagehook;
    217205
    218     add_meta_box('gPostTeaz_settings_box', 'Homepage Teasers', 'gPostTeaz_settings_box', $_genesis_theme_settings_pagehook, 'column2', 'high');
     206    add_meta_box('gPostTeaz-settings-box', 'Teaser Boxes Settings', 'gPostTeaz_settings_box', $_genesis_theme_settings_pagehook, 'column2', 'high' );
    219207}
    220208
     
    225213        echo '<option style="padding-right: 10px;" value="Home Page" '.selected( 'Home Page', genesis_get_option('teasers_enable'), FALSE).'>Home Page</option>';
    226214        echo '<option style="padding-right: 10px;" value="Blog Template" '.selected( 'Blog Template', genesis_get_option('teasers_enable'), FALSE).'>Blog Template</option>';
     215        echo '<option style="padding-right: 10px;" value="Archives" '.selected( 'Archives', genesis_get_option('teasers_enable'), FALSE).'>Archives</option>';
    227216        ?>
    228217    </select></lable>
     
    238227</p>
    239228<p>
    240     <span class="description">NOTE: "Plugin CSS" will allow you to change the teasers height and width. "Child Theme CSS" uses the default styles in child theme for teasers widths and height.</span>
     229    <span class="description">NOTE: "Plugin CSS" will allow you to change the teasers height and width. "Child Theme CSS" uses the styles in child theme for teasers widths and height.</span>
    241230</p>
    242231<div class="css-opts <?php if ( genesis_get_option('use_css') === 'stylesheet' ) echo 'hidden' ?>">
     232    <p><input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_custom_teaser_styles]" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_custom_teaser_styles]" value="1" <?php checked(1, genesis_get_option('enable_custom_teaser_styles')); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_custom_teaser_styles]"><?php _e('Edit teaser styles?', 'genesis'); ?></label></p>
     233    <div class="custom-css-opts <?php if ( genesis_get_option('enable_custom_teaser_styles') != 1 ) echo 'hidden' ?>">
    243234      <hr class="div">
    244235      <p><?php echo "Enter width for teaser boxes: "; ?>
    245236      <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[post_teaser_width]" value="<?php echo esc_attr( genesis_get_option('post_teaser_width') ); ?>" size="3" />px</p>
    246       <p><span class="description">Depending on your layout or child theme you may want to change the width of your teasers. The default is 300. </span></p>
     237      <p><span class="description">Depending on your layout or child theme you may want to change the width of your teasers. By Default it will auto adjust. </span></p>
    247238
    248239      <p><?php echo "Enter height for teaser boxes: "; ?>
    249240      <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[post_teaser_height]" value="<?php echo esc_attr( genesis_get_option('post_teaser_height') ); ?>" size="3" />px</p>
    250241      <p><span class="description">If you want a defined height place here. By default the height will auto adjust. </span></p>
     242      <p><span class="description">( NOTE: When teasers are not show in pairs you cannot edit the height or width from the plugin. ) </span></p>
     243
     244    </div>
    251245</div>
    252246    <hr class="div">
     
    269263
    270264<hr class="div">
    271 <p><input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]" value="1" <?php checked(1, genesis_get_option('enable_teaser_thumbnail')); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]"><?php _e('Include thumbnails on teasers?', 'genesis'); ?></label></p>
    272 <p>
     265<p class="enable-thumbnail"><input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]" value="1" <?php checked(1, genesis_get_option('enable_teaser_thumbnail')); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[enable_teaser_thumbnail]"><?php _e('Include thumbnails on teasers?', 'genesis'); ?></label></p>
     266<p style="padding-left: 20px;" class="select-image-size <?php if ( genesis_get_option('enable_teaser_thumbnail') == '' ) echo 'hidden' ?>">
    273267    <?php _e("Image Size", 'genesis'); ?>:
    274268    <?php $sizes = genesis_get_additional_image_sizes(); ?>
  • genesis-post-teasers/trunk/js/settingslide.js

    r307557 r371658  
    11jQuery(document).ready(function($) {
    22   
    3     $("#gPostTeaz_settings_box input:radio:checked").live('load change', function() {
     3    jQuery("#gPostTeaz-settings-box input:radio:checked").live('load change', function() {
    44       
    5         if ( $(this).val() == 'stylesheet' ) {
    6             $("#gPostTeaz_settings_box .css-opts").hide('fast');
     5        if ( jQuery(this).val() == 'stylesheet' ) {
     6            jQuery("#gPostTeaz-settings-box .css-opts").hide('fast');
    77        }
    88       
    9         if ( $(this).val() != 'stylesheet' ) {
    10             $("#gPostTeaz_settings_box .css-opts").show('fast');
     9        if ( jQuery(this).val() != 'stylesheet' ) {
     10            jQuery("#gPostTeaz-settings-box .css-opts").show('fast');
     11        }
     12       
     13    });
     14   
     15    jQuery("#gPostTeaz-settings-box .css-opts input").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');
     21        }
     22       
     23    });
     24   
     25    jQuery("#gPostTeaz-settings-box .enable-thumbnail input").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');
    1131        }
    1232       
  • genesis-post-teasers/trunk/readme.txt

    r371094 r371658  
    77Stable tag: trunk
    88
    9 This plugin auto generates post teasers for Genesis blog style homepages.
     9This plugin uses the genesis grid loop function to display posts teasers either on your Homepage, Archives, or Blog Template and gives added options to control them.
    1010
    1111== Description ==
    1212
    13 This plugin auto generates post teasers for Genesis blog style homepages. Easily display X amount of full posts before the teasers with following posts being excepts. The Genesis Theme Framework is Required.
     13This plugin uses the genesis grid loop function to display posts teasers either on your Homepage, Archives, or Blog Template and gives added options to control them. Easily have 1,2,3... as many featured posts at top and teasers below. Enable Thumbnails, Disable the byline or post meta and limit the text for the teasers. The Genesis Theme Framework by studiopress is required.
    1414
    1515== Installation ==
     
    2222== Frequently Asked Questions ==
    2323
    24 = What happens when I select Use Custom CSS? =
     24= What happens when I select Use Plugin CSS? =
    2525
    26 This plug in adds additional markup to style the post teasers. Selecting 'Use Custom CSS' will not load any the CSS provided nad require you to add your own to your child theme's style.css.  By default The post teasers will be displayed in pairs side by side.
     26This plug in adds additional markup to style the post teasers. Selecting 'Child Theme CSS' will not load any the CSS provided in the plugin and requires you to add your own to your child theme's style.css.  By default The post teasers will be displayed in pairs side by side.
    2727
    2828= The plug in seems to have done nothing for my site =
    2929
    30 Make sure you have enabled posts teasers by checking 'Enable teasers on home page?' and 'Default CSS' selected.
    31 
    32 *NOTE - This plug in will not work for widgetized homepages.
     30This Plugin will not work with widgetized homepages. If your homepage is widgetized try selecting "Archive" or "Blog Template".
    3331
    3432== Screenshots ==
     
    5149* Added option to display teasers full width.
    5250* Small bug fixes.
     51
     52= 1.0 =
     53* Added ability to display teaser boxes on archives.
     54* Added default settings.
     55* Cleaned up settings widget.
     56* Fixed: Meta box didn't display in Genesis 1.6
     57
Note: See TracChangeset for help on using the changeset viewer.