WordPress.org

Plugin Directory

Changeset 1738914


Ignore:
Timestamp:
09/30/17 18:13:25 (4 months ago)
Author:
greenshady
Message:

Update Clean My Archives to version 1.2.0.

Location:
clean-my-archives
Files:
13 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • clean-my-archives/trunk/changelog.md

    r1309521 r1738914  
    11# Change Log 
     2 
     3## [1.2.0] - 2017-09-30 
     4 
     5### Added 
     6 
     7* New `show_comment_count` parameter.  Set to `0` or `false` to hide the comment count. 
     8* New `format_month_year` parameter to change the month + year date format.  Any valid PHP date format is acceptable. 
     9* New `format_post_date` parameter to change the post date format.  Any valid PHP date format is acceptable. 
     10 
     11### Changed 
     12 
     13* By default, the comment count will only appear if comments are open or the post has existing comments. 
     14 
     15### Fixed 
     16 
     17* When a post doesn't have a title, display the post ID. 
     18* Display the correct monthly archive link for custom post types. 
    219 
    320## [1.1.0] - 2015-12-15 
  • clean-my-archives/trunk/clean-my-archives.php

    r1309521 r1738914  
    22/** 
    33 * Plugin Name: Clean My Archives 
    4  * Plugin URI:  http://themehybrid.com/plugins/clean-my-archives 
     4 * Plugin URI:  https://themehybrid.com/plugins/clean-my-archives 
    55 * Description: A plugin that displays a full archive of posts by month and year with the <code>[clean-my-archives]</code> shortcode. 
    6  * Version:     1.1.0-dev 
     6 * Version:     1.2.0 
    77 * Author:      Justin Tadlock 
    8  * Author URI:  http://justintadlock.com 
     8 * Author URI:  https://themehybrid.com 
     9 * Text Domain: clean-my-archives 
     10 * Domain Path: /lang 
    911 * 
    1012 * Clean My Archives is a plugin developed to simplify the process of adding a list of archives to your 
     
    2325 * 
    2426 * @package   CleanMyArchives 
    25  * @version   1.1.0 
    26  * @author    Justin Tadlock <justin@justintadlock.com> 
    27  * @copyright Copyright (c) 2008 - 2015, Justin Tadlock 
    28  * @link      http://themehybrid.com/plugins/clean-my-archives 
     27 * @version   1.2.0 
     28 * @author    Justin Tadlock <justintadlock@gmail.com> 
     29 * @copyright Copyright (c) 2008 - 2017, Justin Tadlock 
     30 * @link      https://themehybrid.com/plugins/clean-my-archives 
    2931 * @license   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    3032 */ 
     
    4345 
    4446    // Load translations. 
    45     load_plugin_textdomain( 'clean-my-archives', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . 'languages' ); 
     47    load_plugin_textdomain( 'clean-my-archives', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . 'lang' ); 
    4648 
    4749    // Register shortcodes. 
     
    8183    // Default arguments. 
    8284    $defaults = array( 
    83         'limit'     => -1, 
    84         'year'      => '', 
    85         'month'     => '', 
    86         'post_type' => 'post', 
    87         'order'     => 'DESC' 
     85        'limit'              => -1, 
     86        'year'               => '', 
     87        'month'              => '', 
     88        'post_type'          => 'post', 
     89        'order'              => 'DESC', 
     90        // Translators: Month + Year date/time format. 
     91        'format_month_year'  => __( 'F Y', 'clean-my-archives' ), 
     92        // Translators: Day date/time format. 
     93        'format_post_date'   => __( 'd:', 'clean-my-archives' ), 
     94        'show_comment_count' => true 
    8895    ); 
    8996 
    9097    $attr = shortcode_atts( $defaults, $attr, 'clean-my-archives' ); 
     98 
     99    // Validate boolean values passed through shortcode. 
     100    $show_comments = wp_validate_boolean( $attr['show_comment_count'] ) ? 1 : false; 
     101 
     102    // Get the post type. 
     103    $post_type = is_array( $attr['post_type'] ) ? $attr['post_type'] : explode( ',', $attr['post_type'] ); 
    91104 
    92105    // Set up some arguments to pass to WP_Query. 
     
    95108        'year'                => $attr['year'] ? absint( $attr['year'] ) : '', 
    96109        'monthnum'            => $attr['month'] ? absint( $attr['month'] ) : '', 
    97         'post_type'           => is_array( $attr['post_type'] ) ? $attr['post_type'] : explode( ',', $attr['post_type'] ), 
     110        'post_type'           => $post_type, 
    98111        'order'               => in_array( $attr['order'], array( 'ASC', 'DESC' ) ) ? $attr['order'] : 'DESC', 
    99112        'ignore_sticky_posts' => true, 
    100113    ); 
     114 
     115    // If we have one specific post type, let's get the query args to append to the month link 
     116    $query_args = 1 === count( $post_type ) && 'post' !== $post_type[0] ? array( 'post_type' => $post_type[0] ) : false; 
    101117 
    102118    // Create a unique key for this particular set of archives. 
     
    139155                $current_day   = ''; 
    140156 
     157                // Build the month link. 
     158                $month_link = get_month_link( $current_year, $current_month ); 
     159 
     160                if ( $query_args ) 
     161                    $month_link = add_query_arg( $query_args, $month_link ); 
     162 
    141163                // Add a heading with the month and year and link it to the monthly archive. 
    142164                $clean .= sprintf( 
    143165                    '<h2 class="month-year"><a href="%s">%s</a></h2>', 
    144                     esc_url( get_month_link( $current_year, $current_month ) ), 
    145                     esc_html( get_the_time( __( 'F Y', 'clean-my-archives' ) ) ) 
     166                    esc_url( $month_link ), 
     167                    esc_html( get_the_time( $attr['format_month_year'] ) ) 
    146168                ); 
    147169 
     
    151173 
    152174            // Get the post's day. 
    153             $day = sprintf( '<span class="day">%s</span>', get_the_time( esc_html__( 'd:', 'clean-my-archives' ) ) ); 
    154  
    155             // Translators: %d is the comment count. 
    156             $comments_num = sprintf( esc_html__( '(%d)', 'clean-my-archives' ), get_comments_number() ); 
    157             $comments     = sprintf( '<span class="comments-number">%s</span>',  $comments_num ); 
     175            $day = sprintf( '<span class="day">%s</span>', esc_html( get_the_time( $attr['format_post_date'] ) ) ); 
     176 
     177            // Set up the comments variable. 
     178            $comments = ''; 
     179 
     180            if ( $show_comments && ( comments_open() || get_comments_number() ) ) { 
     181 
     182                // Translators: %d is the comment count. 
     183                $comments_num = sprintf( esc_html__( '(%d)', 'clean-my-archives' ), get_comments_number() ); 
     184                $comments     = sprintf( '<span class="comments-number">%s</span>',  $comments_num ); 
     185            } 
    158186 
    159187            // Check if there's a duplicate day so we can add a class. 
     
    161189            $current_day   = $daynum; 
    162190 
    163             // Add the post list item to the formatted archives. 
    164             $clean .= the_title( 
    165                 sprintf( '<li%s>%s <a href="%s" rel="bookmark">', $duplicate_day, $day, esc_url( get_permalink() ) ), 
    166                 sprintf( '</a> %s</li>', $comments ), 
    167                 false 
     191            $clean .= sprintf( 
     192                '<li%s>%s <a href="%s" rel="bookmark">%s</a> %s</li>', 
     193                $duplicate_day, 
     194                $day, 
     195                esc_url( get_permalink() ), 
     196                get_the_title() ? the_title( '', '', false ) : get_the_ID(), 
     197                $comments 
    168198            ); 
    169199        } 
  • clean-my-archives/trunk/readme.md

    r1309521 r1738914  
    1515However, there are some parameters you can use.  The following are examples of these parameters in use. 
    1616 
    17 #### Limit the number of posts with the `limit` parameter: 
     17### Limit the number of posts with the `limit` parameter: 
    1818 
    1919    [clean-my-archives limit="100"] 
    2020 
    21 #### Reverse the order with the `order` parameter (default is `DESC`): 
     21### Reverse the order with the `order` parameter (default is `DESC`): 
    2222 
    2323    [clean-my-archives order="ASC"] 
     
    2525    [clean-my-archives order="DESC"] 
    2626 
    27 #### Use the `year` parameter to limit to a year: 
     27### Use the `year` parameter to limit to a year: 
    2828 
    2929    [clean-my-archives year="2013"] 
    3030 
    31 #### Use the `month` parameter to limit by month: 
     31### Use the `month` parameter to limit by month: 
    3232 
    3333    [clean-my-archives month="12"] 
    3434 
    35 #### Load specific post types with the `post_type` parameter 
     35### Load specific post types with the `post_type` parameter: 
    3636 
    3737    [clean-my-archives post_type="post"] 
     
    3939    [clean-my-archives post_type="post, page"] 
    4040 
    41 #### Pagination (via the post/page editor): 
     41### Disable the comment count from showing: 
     42 
     43    [clean-my-archives show_comment_count="0"] 
     44 
     45### Change the month and day date/time format 
     46 
     47    [clean-my-archives format_month_year="F Y" format_post_date="d:"] 
     48 
     49For a full list of formats, see the [PHP Date Formats](http://php.net/manual/en/datetime.formats.date.php) guide. 
     50 
     51### Pagination (via the post/page editor): 
    4252 
    4353    [clean-my-archives year="2013"] 
     
    4757    [clean-my-archives year="2011"] 
    4858 
    49 ## Professional Support 
    50  
    51 If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing). 
    52  
    5359## Copyright and License 
    5460 
    5561This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later. 
    5662 
    57 2008&thinsp;&ndash;&thinsp;2015 &copy; [Justin Tadlock](http://justintadlock.com). 
     632008 - 2017 &copy; [Justin Tadlock](http://justintadlock.com). 
  • clean-my-archives/trunk/readme.txt

    r1309521 r1738914  
    22 
    33Contributors: greenshady 
    4 Donate link: http://themehybrid.com/donate 
     4Donate link: https://themehybrid.com/donate 
    55Tags: archives, shortcode 
    66Requires at least: 3.1 
    7 Tested up to: 3.7 
    8 Stable tag: 1.0.0 
     7Tested up to: 4.8.2 
     8Requires PHP: 5.2 
     9Stable tag: 1.2.0 
    910License: GPLv2 or later 
    1011License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    2223### Professional Support 
    2324 
    24 If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing). 
     25If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](https://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 75,000+ users (and growing). 
    2526 
    2627### Plugin Development 
    2728 
    28 If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/clean-my-archives).  
     29If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/clean-my-archives). 
    2930 
    3031### Donations 
    3132 
    32 Yes, I do accept donations.  If you want to buy me a beer or whatever, you can do so from my [donations page](http://themehybrid.com/donate).  I appreciate all donations, no matter the size.  Further development of this plugin is not contingent on donations, but they are always a nice incentive. 
     33Yes, I do accept donations.  If you want to donate, you can do so from my [donations page](https://themehybrid.com/donate) or grab me something from my [Amazon Wish List](http://a.co/flUb0ns). 
    3334 
    34 == Installation == 
    35  
    36 1. Uzip the `clean-my-archives.zip` folder. 
    37 2. Upload the `clean-my-archives` folder to your `/wp-content/plugins` directory. 
    38 3. In your WordPress dashboard, head over to the *Plugins* section. 
    39 4. Activate *Clean My Archives*. 
     35I appreciate all donations, no matter the size.  Further development of this plugin is not contingent on donations, but they are always a nice incentive. 
    4036 
    4137== Frequently Asked Questions == 
     
    4339### Why was this plugin created? 
    4440 
    45 First and foremost, I wanted a simple archives solution for, what's now, over 10 years of blog posts.  You can check out [my archives](http://justintadlock.com/archives) to see how the plugin performs. 
     41First and foremost, I wanted a simple archives solution for, what's now, over 12 years of blog posts.  You can check out [my archives](http://justintadlock.com/archives) to see how the plugin performs. 
    4642 
    4743The second reason was to share my solution with other users who want the same simplicity. 
     
    5652 
    5753    [clean-my-archives limit="100"] 
    58      
     54 
    5955#### Reverse the order with the `order` parameter (default is `DESC`): 
    60      
     56 
    6157    [clean-my-archives order="ASC"] 
    6258 
     
    7167    [clean-my-archives month="12"] 
    7268 
    73 #### Load specific post types with the `post_type` parameter 
     69#### Load specific post types with the `post_type` parameter: 
    7470 
    7571    [clean-my-archives post_type="post"] 
    7672 
    7773    [clean-my-archives post_type="post, page"] 
     74 
     75#### Disable the comment count from showing: 
     76 
     77    [clean-my-archives show_comment_count="0"] 
     78 
     79#### Change the month and day date/time format 
     80 
     81    [clean-my-archives format_month_year="F Y" format_post_date="d:"] 
     82 
     83For a full list of formats, see the [PHP Date Formats](http://php.net/manual/en/datetime.formats.date.php) guide. 
    7884 
    7985### Does it support pagination? 
Note: See TracChangeset for help on using the changeset viewer.