Plugin Directory

Changeset 652236


Ignore:
Timestamp:
01/14/2013 01:54:07 AM (13 years ago)
Author:
ethanhackett
Message:

Fixed a but with urls ending with or without forward slashes.
Added pagination location options for top, bottom or both.
Updated the admin panel to look a tad sexier.

Location:
post-tiles
Files:
1 added
3 edited

Legend:

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

    r651739 r652236  
    4747}
    4848#category-list {
    49 
    5049    float: left;
    5150    margin-left: 20px;
    5251    overflow: auto;
     52}
     53#category-list li {
     54    padding: 5px 10px;
     55    margin-bottom: 0;
    5356}
    5457.tc-note {
     
    8689.category-key-list-item {
    8790    overflow: auto;
    88     margin-top: 10px;
    8991    margin-bottom: 0;
    90     padding-top: 10px;
    91     padding-bottom: 0;
    9292    border-top: 1px solid #dbdbdb;
     93    margin-top: 0;
     94    padding: 10px;
     95}
     96#category-list ul li:nth-child(odd) {
     97    background-color: #f7f7f7;
    9398}
    9499.small-input {
     
    98103    width: 96px;
    99104}
    100 
    101105#submit-button {
    102     margin-top: 10px;
    103106    padding-top: 10px;
    104107    border-top: 1px solid #dbdbdb;
    105 }
    106 
     108    padding-bottom: 10px;
     109}
    107110.category-key-radio {
    108111    float: left;
     
    126129
    127130/* Frontend CSS */
     131#post-tiles-container {
     132    padding-top: 15px;
     133}
    128134ul#post-tiles {
    129135    margin: 0;
    130     padding: 14px 10px 10px;
     136    padding: 0 10px 10px;
    131137    overflow: auto;
    132138}
     
    185191#category-key {
    186192    overflow: auto;
    187     padding-top: 14px;
    188     padding-right: 0 !important;
    189     padding-left: 0 !important;
     193    padding-right: 0;
     194    padding-left: 0;
     195    padding-bottom: 14px;
    190196}
    191197#category-key a{
  • post-tiles/trunk/post-tiles.php

    r651739 r652236  
    55Description: This plugin displays recent posts as tiles. Posts can choose categories by id and numbeer of posts to display. Example shortcode: [post-tiles] or [post-tiles categories='1,2,4,10' posts='8' excerpt='18'].
    66Author: Ethan Hackett
    7 Version: 1.3.4
     7Version: 1.3.5
    88Author URI: http://www.posttiles.com
    99
     
    122122    $pagination_key = get_option('pagination-key');
    123123    if(empty($pagination_key)){
    124         $pagination_key = "true";
     124        $pagination_key = "bottom";
    125125    }
    126126    $featured_images_key = get_option('featured-images');
     
    258258    <li class='category-key-list-item'>
    259259      <div class='category-key-radio'>
    260           <input type="radio" name="pagination-key" <?php if($pagination_key == 'true') echo 'checked="checked"'; ?> value="true" /> Show &nbsp;&nbsp;
    261           <input type="radio" name="pagination-key" <?php if($pagination_key == 'false') echo 'checked="checked"'; ?> value="false" /> hide&nbsp;
     260          <select name="pagination-key" id="animation-style">
     261            <option value="none" <?php if($pagination_key == 'none') echo 'selected="selected"'; ?>>None</option>
     262            <option value="top" <?php if($pagination_key == 'top') echo 'selected="selected"'; ?>>Top</option>
     263            <option value="bottom" <?php if($pagination_key == 'bottom') echo 'selected="selected"'; ?>>Bottom</option>
     264            <option value="both" <?php if($pagination_key == 'both') echo 'selected="selected"'; ?>>Both</option>
     265          </select>
    262266      </div>
    263267      <div class='category-key-admin'>
     
    454458       $pagination_key = get_option('pagination-key');
    455459       if(empty($pagination_key)){
    456           $pagination_key = "true";
    457        }
    458        
    459        if ($pagination_key == "true") {
     460          $pagination_key = "bottom";
     461       }
     462       if ($pagination_key == "top" || $pagination_key == "both" || $pagination_key == "bottom") {
    460463            // Build out the pagination
    461464             global $wp_query; 
    462465             // Get the total number of pages
    463466            $total_pages = $wp_query->max_num_pages;
    464             // If the total of pages is greater than one create the pagination 
    465             if ($total_pages > 1){ 
    466               $current_page = max(1, get_query_var('paged')); 
    467               $pagination = paginate_links(array( 
    468                   'base' => get_pagenum_link(1) . '%_%', 
    469                   'format' => 'page/%#%', 
     467            // Fix the url leading slash
     468            // Get the url
     469            $url = get_permalink();
     470            // get the last character of the url string either / or not
     471            $lastchar = substr( $url, -1 );
     472            // if the last character is or isn't a / configure the pagination formating accordingly
     473            if ( $lastchar != '/' ){
     474               $format = "/page/%#%";
     475            } else {
     476               $format = "page/%#%";
     477            }
     478            // If the total of pages is greater than one create the pagination
     479            if ($total_pages > 1){
     480               $current_page = max(1, get_query_var('paged'));
     481               $pagination = paginate_links(array(
     482               'base' => get_pagenum_link(1) . '%_%',
     483               'format' => $format, 
    470484                  'current' => $current_page, 
    471485                  'total' => $total_pages, 
     
    476490            }
    477491       } else {
    478         $pagination = "<!-- Post Tiles pagination is disabled in the settings -->";
    479        }
    480        
    481        
     492         $pagination = "<!-- Post Tiles pagination is disabled in the settings -->";
     493       }
     494       if ($pagination_key == "top") {
     495            $top_pagination = $pagination;
     496       } elseif ($pagination_key == "bottom")  {
     497            $bottom_pagination = $pagination;
     498       } elseif ($pagination_key == "both") {
     499            $top_pagination = $pagination;
     500            $bottom_pagination = $pagination;
     501       } else {
     502            $top_pagination = $pagination;
     503            $bottom_pagination = $pagination;
     504       }
    482505               
    483506       // the loop
     
    600623       }
    601624         
    602        return $key_finished.'<ul id="post-tiles" '.$responsive.'>'.$output.'</ul>'.$pagination;
     625       return '<div id="post-tiles-container">'.$top_pagination.$key_finished.'<ul id="post-tiles" '.$responsive.'>'.$output.'</ul>'.$bottom_pagination.'</div>';
    603626       
    604627       $plugin_url = plugins_url()."/post-tiles";
  • post-tiles/trunk/readme.txt

    r651739 r652236  
    55Requires at least: 3.0
    66Tested up to: 3.5.0
    7 Stable tag: 1.3.4
     7Stable tag: 1.3.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323*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']**
    2424
    25 Version 1.3.4
     25Version 1.3.5
    2626
    2727== Installation ==
     
    4545
    4646== Changelog ==
     47
     48= 1.3.5 =
     49* Fixed a but with urls ending with or without forward slashes.
     50* Added pagination location options for top, bottom or both.
     51* Updated the admin panel to look a tad sexier.
    4752
    4853= 1.3.4 =
Note: See TracChangeset for help on using the changeset viewer.