Plugin Directory

Changeset 519660


Ignore:
Timestamp:
03/16/2012 02:44:47 AM (14 years ago)
Author:
ethanhackett
Message:

I fixed a bug in the truncation of the excerpts caused by other plugins/themes.

Location:
post-tiles/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • post-tiles/trunk/post-tiles.php

    r517667 r519660  
    55Description: This plugin displays recent posts as tiles. Posts can choose categories by id and numbeer of posts to display. Example shortcode: <strong>[post-tiles]</strong> or <strong>[post-tiles categories="1,2,4,10" posts="8" excerpt="18"]</strong>.
    66Author: Ethan Hackett - TinCrate
    7 Version: 1.2.4
     7Version: 1.2.5
    88Author URI: http://www.tincrate.com/plugins
    99
     
    227227       
    228228       // Configure Both Categories and Number of Posts For Query
    229        $excerpt = $atts['excerpt'];
    230        if (empty($excerpt)) {
    231            $excerpt =  '19';
    232        }
    233        define("pt_excerpt", $excerpt);
    234        
     229       $excerpt_length = $atts['excerpt'];
    235230       
    236231       // Configure Categories For Query
     
    287282          $temp_link = get_permalink($post->ID);
    288283          $temp_excerpt = get_the_excerpt($post->ID);
     284         
     285          // Check to see if the excerpt was not defined thus empty
     286          if ($excerpt_length == "") {
     287               // Set excerpt length to 19 as default.
     288              $excerpt_length =  '19';
     289          }
     290          // Truncates the excerpt length (Not using default wordpress for plugin conflicts)
     291          $words = explode(' ', $temp_excerpt);
     292          if (count($words) > $excerpt_length){
     293            array_splice($words, $excerpt_length);
     294            $temp_excerpt = implode(' ', $words);
     295            $temp_excerpt .= '&hellip;';
     296          }
     297             
     298           
     299       
    289300         
    290301          // Grabs the categories then assigns the first category in the string to the class.
     
    305316          }
    306317         
    307           // Retrieve the option feature image
     318          // Retrieve the option feature image.
    308319          $featured_images_key = get_option('featured-images');
    309           // See if Featured image is true
     320          // See if Featured image is true.
    310321          // Clear features_style variable.
    311322          $featured_style = "";
     323          // Get the post ID.
     324          $theID = get_the_ID();
    312325          // If there is a featured image.
    313326          if ($featured_images_key == "true") {
    314327              if ( has_post_thumbnail()) {
    315328                  // Retrieve the featured image.
    316                   $thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
     329                  $thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'medium');
    317330                  // Strip featured image down to the url.
    318331                  $url = $thumb['0'];
     
    321334         }
    322335          // Each output creates the li > link > title > exerpt
    323           $output .= "<li ".$featured_style."><a href='$temp_link' class='".$cat_var."'style='background-color: $cat_var_value;'><h3>$temp_title</h3>$temp_excerpt</a></li>\n";
     336          $output .= "<li ".$featured_style." id='".$theID."'><a href='$temp_link' class='".$cat_var."'style='background-color: $cat_var_value;'><h3>$temp_title</h3>$temp_excerpt</a></li>\n";
    324337          // Each output_key creates a li > category color block > category name
    325338             
     
    386399//  wp_enqueue_script('post-tiles', $plugin_url.'/post-tiles-frontend.js' );
    387400}
    388 
    389 // Set's Excerpt Length
    390 add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    391 
    392 function custom_excerpt_length( $length ) {
    393         return pt_excerpt;
    394     }
    395 
    396401?>
  • post-tiles/trunk/readme.txt

    r517675 r519660  
    55Requires at least: 3.0
    66Tested up to: 3.3
    7 Stable tag: 1.2.4
     7Stable tag: 1.2.5
    88
    99Post Tiles gives admins the ability to display their posts as tiles. The tiles are color coded by category.
     
    2121*NOTE:* The category id numbers are listed below, next to the category names. You can use both the categories and posts attributes **Example: [post-tiles categories='1,2,4' posts='8' excerpt='18']**
    2222
    23 Version 1.2.4
     23Version 1.2.5
    2424
    2525== Installation ==
     
    3232== Screenshots ==
    3333
    34 1. The admin panel gives you the flexibility to use a color picker and define the background color of each category screenshot-1.jpg.
    35 2. The front end output displays your posts in a tiled format screenshot-2.jpg.
     341. The admin panel gives you the flexibility to use a color picker and define the background color of each category /tags/1.2.5/screenshot-1.png
     352. The front end output displays your posts in a tiled format /tags/1.2.5/screenshot-2.png
    3636
    3737== Changelog ==
     38
     39= 1.2.5 =
     40* Fix the excerpt issue regarding truncation
    3841
    3942= 1.2.4 =
Note: See TracChangeset for help on using the changeset viewer.