Plugin Directory

Changeset 3401627


Ignore:
Timestamp:
11/24/2025 07:58:46 AM (3 months ago)
Author:
parorrey
Message:

Updating version 0.6.5

Location:
recent-cpt/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • recent-cpt/trunk/readme.txt

    r3398307 r3401627  
    66Requires at least: 2.9.3
    77Tested up to: 6.8.3
    8 Stable tag: 0.6.3
     8Stable tag: 0.6.5
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4040
    4141== Changelog ==
     42= 0.6.5 =
     43* Fixed bugs for html and displaying date, categories and tags from admin panel
    4244
    4345= 0.6.3 =
  • recent-cpt/trunk/recent-cpt.php

    r3398307 r3401627  
    33Plugin Name: Recent CPT Widget Thumbnails
    44Plugin URI: http://www.parorrey.com
    5 Description: A plugin that adds a widget that lists your most recent posts, cpt with excerpts & thumbnails. The number of posts and the character limit of the excerpts are configurable.
    6 Version: 0.6.3
     5Description: Recent posts/CPTs with thumbnails, excerpt, date, clickable categories & tags.
     6Version: 0.6.5
    77Text Domain: recent-cpt
    88Author: Ali Qureshi
     
    1111*/
    1212
    13 // Custom pi_rcwt_excerpt funtion that allows to limit the number of characters
    1413function pi_rcwt_excerpt( $count ) {
    15     $permalink = get_permalink();
    16     $excerpt = get_the_content();
    17     $excerpt = strip_shortcodes( $excerpt );
    18     $excerpt = wp_strip_all_tags( $excerpt );
    19     $excerpt = substr( $excerpt, 0, $count );
    20     $excerpt = substr( $excerpt, 0, strripos( $excerpt, " " ));
    21     $excerpt = $excerpt.'<a href="'.esc_url($permalink).'" class="more-link">...</a>';
    22     return $excerpt;
     14    $permalink = get_permalink();
     15    $excerpt = get_the_content();
     16    $excerpt = strip_shortcodes( $excerpt );
     17    $excerpt = wp_strip_all_tags( $excerpt );
     18    $excerpt = substr( $excerpt, 0, $count );
     19    $excerpt = substr( $excerpt, 0, strripos( $excerpt, " " ) );
     20    $excerpt = $excerpt.'<a href="'.esc_url($permalink).'" class="more-link">...</a>';
     21    return $excerpt;
    2322}
    2423
    2524class PI_RCWT_RecentCPTWidgetThumbnails extends WP_Widget {
    26    
    27     function __construct() {
    28         $widget_ops = array( 'classname' => 'recent-cpt-thumbnails', 'description' => esc_html(__( 'The most recent posts on your site with excerpts & thumbnails', 'recent-cpt' ) ) );
    29         parent::__construct( 'PI_RCWT_RecentCPTWidgetThumbnails', esc_html(__( 'Recent CPT Widget Thumbnails', 'recent-cpt' ) ), $widget_ops );
    30     }
    3125
    32     function widget( $args, $instance ) {
    33     $before_widget = isset( $args['before_widget'] ) ? wp_kses_post( $args['before_widget'] ) : '<aside id="%1$s" class="widget %2$s">';
    34     $after_widget  = isset( $args['after_widget'] )  ? wp_kses_post( $args['after_widget'] )  : '</aside>';
    35     $before_title  = isset( $args['before_title'] )  ? wp_kses_post( $args['before_title'] )  : '<h3 class="widget-title">';
    36     $after_title   = isset( $args['after_title'] )   ? wp_kses_post( $args['after_title'] )   : '</h3>';
     26    function __construct() {
     27        parent::__construct(
     28            'PI_RCWT_RecentCPTWidgetThumbnails',
     29            'Recent CPT Widget Thumbnails',
     30            array( 'description' => 'Recent posts with thumbnails, excerpt, date, categories & tags' )
     31        );
     32    }
    3733
    38     $title_text = empty( $instance['title'] ) ? esc_html__( 'Recent Posts', 'recent-cpt' ) : sanitize_text_field( $instance['title'] );
    39     $title      = apply_filters( 'widget_title', $title_text, $instance, $this->id_base );
     34    function widget( $args, $instance ) {
     35        extract( $args );
    4036
    41     $allowed_tags_custom = wp_kses_allowed_html( 'post' );
     37        $title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title']);
    4238
    43     echo $before_widget;
     39        echo $before_widget;
     40        if ( $title ) echo $before_title . $title . $after_title;
    4441
    45     if ( ! empty( $title ) ) {
    46         echo $before_title . esc_html($title) . $after_title;
     42        // FIXED: Use isset() instead of empty() so custom width/height actually work!
     43        $numposts     = isset($instance['numposts'])     ? absint($instance['numposts'])     : 5;
     44        $characters   = isset($instance['characters'])   ? absint($instance['characters'])   : 100;
     45        $thumb_width  = isset($instance['thumb_width'])  ? absint($instance['thumb_width'])  : 55;
     46        $thumb_height = isset($instance['thumb_height']) ? absint($instance['thumb_height']) : 55;
     47        $post_type    = isset($instance['post_type'])    ? sanitize_text_field($instance['post_type']) : 'post';
     48        $cat          = isset($instance['cat'])          ? intval($instance['cat'])          : 0;
     49        $tag          = isset($instance['tag'])          ? sanitize_text_field($instance['tag']) : '';
     50        $show_date    = !empty($instance['display_date']);
     51        $show_cats    = !empty($instance['display_cats']);
     52        $show_tags    = !empty($instance['display_tags']);
     53
     54        $q = new WP_Query(array(
     55            'posts_per_page'      => $numposts,
     56            'post_type'           => $post_type,
     57            'cat'                 => $cat > 0 ? $cat : '',
     58            'tag'                 => $tag,
     59            'ignore_sticky_posts' => true,
     60            'no_found_rows'       => true,
     61        ));
     62
     63        if ($q->have_posts()) : ?>
     64            <ul style="list-style:none;padding:0;margin:0;">
     65            <?php while ($q->have_posts()) : $q->the_post(); ?>
     66                <li style="margin-bottom:20px;overflow:hidden;clear:both;">
     67                   
     68
     69                    <div style="overflow:hidden;">
     70                         <?php if (has_post_thumbnail()) : ?>
     71                         <a href="<?php the_permalink(); ?>">
     72                            <?php the_post_thumbnail(array($thumb_width, $thumb_height)); ?>
     73                        </a>
     74                    <?php endif; ?>
     75                        <a href="<?php the_permalink(); ?>" style="font-weight:bold;text-decoration:none;">
     76                            <?php the_title(); ?>
     77                        </a><br/>
     78
     79                        <?php if ($show_date) : ?>
     80                            <small style="color:#666;">
     81                                <strong>Posted:</strong> <?php echo get_the_date(); ?>
     82                            </small><br/>
     83                        <?php endif; ?>
     84
     85                        <?php if ($show_cats) : ?>
     86                            <small style="color:#666;">
     87                                <strong>Categories:</strong>
     88                                <?php
     89                                $cats = get_the_category();
     90                                if ($cats) {
     91                                    $links = array();
     92                                    foreach ($cats as $c) {
     93                                        $links[] = '<a href="'.get_category_link($c->term_id).'">'.$c->name.'</a>';
     94                                    }
     95                                    echo implode(', ', $links);
     96                                } else echo '—';
     97                                ?>
     98                            </small><br/>
     99                        <?php endif; ?>
     100
     101                        <?php if ($show_tags) : ?>
     102                            <small style="color:#666;">
     103                                <?php the_tags('<strong>Tags:</strong> ', ', ', ''); ?>
     104                            </small><br/>
     105                        <?php endif; ?>
     106
     107                        <div style="margin-top:8px;font-size:0.92em;line-height:1.4;">
     108                            <?php echo pi_rcwt_excerpt($characters); ?>
     109                        </div>
     110                    </div>
     111                </li>
     112            <?php endwhile; wp_reset_postdata(); ?>
     113            </ul>
     114        <?php endif;
     115
     116        if (!empty($instance['linkurl']) && !empty($instance['linktext'])) {
     117            echo '<p style="margin:15px 0 0;"><a href="'.esc_url($instance['linkurl']).'" style="font-weight:bold;">'.esc_html($instance['linktext']).'</a></p>';
     118        }
     119
     120        echo $after_widget;
    47121    }
    48     ?>
    49    
    50     <!-- Inline CSS for spacing (adjust as needed in your theme's stylesheet) -->
    51     <style>.pi-rcwt-list { list-style: none; padding: 0; margin: 0; } .pi-rcwt-item { margin-bottom: 1em; overflow: hidden; clear: both; } .pi-rcwt-content { display: block; }</style>
    52122
    53     <ul class="pi-rcwt-list">
    54     <?php
    55     $posts_limit = isset( $instance['numposts'] ) ? (int) $instance['numposts'] : 5;
    56     $post_type      = isset( $instance['post_type'] ) ? sanitize_text_field( $instance['post_type'] ) : 'post';
    57     $cat            = isset( $instance['cat'] ) ? (int) $instance['cat'] : 0;
    58     $tag            = isset( $instance['tag'] ) ? sanitize_text_field( $instance['tag'] ) : '';
    59     $display_cats   = isset( $instance['display_cats'] ) ? (bool) $instance['display_cats'] : false;
    60     $display_tags   = isset( $instance['display_tags'] ) ? (bool) $instance['display_tags'] : false;
    61     $display_date   = isset( $instance['display_date'] ) ? (bool) $instance['display_date'] : false;
    62        
     123    function update($new_instance, $old_instance) {
     124        $instance = $old_instance;
     125        $instance['title']         = sanitize_text_field($new_instance['title']);
     126        $instance['numposts']      = absint($new_instance['numposts']);
     127        $instance['characters']    = absint($new_instance['characters']);
     128        $instance['thumb_width']   = absint($new_instance['thumb_width']);
     129        $instance['thumb_height']  = absint($new_instance['thumb_height']);
     130        $instance['post_type']     = sanitize_text_field($new_instance['post_type']);
     131        $instance['cat']           = absint($new_instance['cat']);
     132        $instance['tag']           = sanitize_text_field($new_instance['tag']);
     133        $instance['linktext']      = sanitize_text_field($new_instance['linktext']);
     134        $instance['linkurl']       = esc_url_raw($new_instance['linkurl']);
     135        $instance['display_date']  = !empty($new_instance['display_date']) ? 1 : 0;
     136        $instance['display_cats']  = !empty($new_instance['display_cats']) ? 1 : 0;
     137        $instance['display_tags']  = !empty($new_instance['display_tags']) ? 1 : 0;
     138        return $instance;
     139    }
    63140
    64     $query_args = array(
    65         'posts_per_page'   => $posts_limit,
    66         'post_type'        => $post_type,
    67         'cat'              => $cat,
    68         'tag'              => $tag,
    69         'no_found_rows'    => true,
    70         'suppress_filters' => true,
    71     );
     141    function form($instance) {
     142        $instance = wp_parse_args((array)$instance, array(
     143            'title'=>'Recent Posts','numposts'=>5,'characters'=>100,
     144            'thumb_width'=>80,'thumb_height'=>80,'post_type'=>'','cat'=>0,'tag'=>'',
     145            'linktext'=>'','linkurl'=>'','display_date'=>0,'display_cats'=>0,'display_tags'=>0
     146        ));
     147        ?>
     148        <p><label><strong>Title:</strong></label>
     149        <input class="widefat" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" /></p>
    72150
    73     $recent_posts_query = new WP_Query( $query_args );
     151        <p><label>Number of posts:</label>
     152        <input class="widefat" name="<?php echo $this->get_field_name('numposts'); ?>" type="text" value="<?php echo esc_attr($instance['numposts']); ?>" /></p>
    74153
    75     if ( $recent_posts_query->have_posts() ) :
    76         while ( $recent_posts_query->have_posts() ) : $recent_posts_query->the_post();
    77        
    78         $thumb_width  = isset( $instance['thumb_width'] ) ? (int) $instance['thumb_width'] : 50;
    79         $thumb_height = isset( $instance['thumb_height'] ) ? (int) $instance['thumb_height'] : 50;
    80         ?>
    81        
    82         <li class="pi-rcwt-item">
    83             <div class="pi-rcwt-thumbnail">
    84             <?php
    85             if ( has_post_thumbnail() ) {
    86                 the_post_thumbnail( array( $thumb_width, $thumb_height ), array( 'class' => 'alignleft' ) );
    87             }
    88             ?>
    89             </div>
    90             <div class="pi-rcwt-content">
    91                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    92                
    93                 <?php if ( $display_date ) : ?>
    94                     <div class="pi-rcwt-meta pi-rcwt-date">
    95                         <span class="meta-label"><?php esc_html_e('Posted:', 'recent-cpt'); ?></span>
    96                         <time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
    97                     </div>
    98                 <?php endif; ?>
     154        <p><label>Excerpt length (characters):</label>
     155        <input class="widefat" name="<?php echo $this->get_field_name('characters'); ?>" type="text" value="<?php echo esc_attr($instance['characters']); ?>" /></p>
    99156
    100                 <?php if ( $display_cats && $post_type === 'post' ) : ?>
    101                     <div class="pi-rcwt-meta pi-rcwt-categories">
    102                         <span class="meta-label"><?php esc_html_e('Categories:', 'recent-cpt'); ?></span>
    103                         <?php the_category(', '); ?>
    104                     </div>
    105                 <?php endif; ?>
     157        <p><label>Thumbnail Width (px):</label>
     158        <input class="widefat" name="<?php echo $this->get_field_name('thumb_width'); ?>" type="text" value="<?php echo esc_attr($instance['thumb_width']); ?>" />
     159        <small>Now works perfectly — try 150, 200, 300...</small></p>
    106160
    107                 <?php if ( $display_tags && $post_type === 'post' ) : ?>
    108                     <div class="pi-rcwt-meta pi-rcwt-tags">
    109                         <?php the_tags('<span class="meta-label">' . esc_html__('Tags:', 'recent-cpt') . '</span> ', ', ', ''); ?>
    110                     </div>
    111                 <?php endif; ?>
     161        <p><label>Thumbnail Height (px):</label>
     162        <input class="widefat" name="<?php echo $this->get_field_name('thumb_height'); ?>" type="text" value="<?php echo esc_attr($instance['thumb_height']); ?>" /></p>
    112163
    113                 <div class="pi-rcwt-excerpt">
    114                     <?php
    115                     $characters = isset( $instance['characters'] ) ? (int) $instance['characters'] : 100;
    116                     echo wp_kses(
    117                         pi_rcwt_excerpt( $characters ),
    118                         $allowed_tags_custom
    119                     );
    120                     ?>
    121                 </div>
    122             </div>
    123         </li>
    124     <?php endwhile;
    125     endif;
    126     ?>
    127     </ul>
     164        <p><label>Custom Post Type:</label>
     165        <select class="widefat" name="<?php echo $this->get_field_name('post_type'); ?>">
     166            <option value="">Regular Posts</option>
     167            <?php foreach(get_post_types(array('public'=>true,'_builtin'=>false),'names') as $cpt): ?>
     168                <option value="<?php echo esc_attr($cpt); ?>" <?php selected($instance['post_type'],$cpt); ?>><?php echo $cpt; ?></option>
     169            <?php endforeach; ?>
     170        </select></p>
    128171
    129     <?php
    130     $linkurl  = isset( $instance['linkurl'] ) ? esc_url( $instance['linkurl'] ) : '';
    131     $linktext = isset( $instance['linktext'] ) ? esc_html( $instance['linktext'] ) : '';
     172        <p>Limit to category:<br>
     173        <?php wp_dropdown_categories(array('name'=>$this->get_field_name('cat'),'selected'=>$instance['cat'],'show_option_all'=>'All Categories')); ?></p>
    132174
    133     if( !empty( $linkurl ) && !empty( $linktext ) ) { ?>
    134         <a href="<?php echo $linkurl; ?>" class="morelink"><?php echo $linktext; ?></a>
    135     <?php }
     175        <p><label>Tags (comma separated):</label>
     176        <input class="widefat" name="<?php echo $this->get_field_name('tag'); ?>" type="text" value="<?php echo esc_attr($instance['tag']); ?>" /></p>
    136177
    137     echo $after_widget;
     178        <p><input type="checkbox" <?php checked($instance['display_date'],1); ?> name="<?php echo $this->get_field_name('display_date'); ?>" />
     179        <label>Display Post Date?</label></p>
    138180
    139     wp_reset_postdata();
     181        <p><input type="checkbox" <?php checked($instance['display_cats'],1); ?> name="<?php echo $this->get_field_name('display_cats'); ?>" />
     182        <label>Display Categories? (clickable)</label></p>
     183
     184        <p><input type="checkbox" <?php checked($instance['display_tags'],1); ?> name="<?php echo $this->get_field_name('display_tags'); ?>" />
     185        <label>Display Tags?</label></p>
     186
     187        <p><label>Bottom link text:</label>
     188        <input class="widefat" name="<?php echo $this->get_field_name('linktext'); ?>" type="text" value="<?php echo esc_attr($instance['linktext']); ?>" /></p>
     189
     190        <p><label>Bottom link URL:</label>
     191        <input class="widefat" name="<?php echo $this->get_field_name('linkurl'); ?>" type="text" value="<?php echo esc_attr($instance['linkurl']); ?>" /></p>
     192        <?php
     193    }
    140194}
    141195
    142     function update( $new_instance, $old_instance ) {
    143     $instance = $old_instance;
    144 
    145     $instance['title']    = sanitize_text_field( $new_instance['title'] );
    146     $instance['post_type'] = sanitize_text_field( $new_instance['post_type'] );
    147     $instance['tag']       = sanitize_text_field( $new_instance['tag'] );
    148     $instance['linktext']  = sanitize_text_field( $new_instance['linktext'] );
    149     $instance['linkurl'] = esc_url_raw( $new_instance['linkurl'] );
    150 
    151     $instance['numposts']     = absint( $new_instance['numposts'] );
    152     $instance['characters']   = absint( $new_instance['characters'] );
    153     $instance['thumb_width']  = absint( $new_instance['thumb_width'] );
    154     $instance['thumb_height'] = absint( $new_instance['thumb_height'] );
    155     $instance['cat']          = absint( $new_instance['cat'] );
    156 
    157     $instance['display_cats'] = isset( $new_instance['display_cats'] );
    158     $instance['display_tags'] = isset( $new_instance['display_tags'] );
    159     $instance['display_date'] = isset( $new_instance['display_date'] );
    160 
    161     return $instance;
    162 }
    163 
    164     function form( $instance ) {
    165         // Widget defaults
    166         $instance = wp_parse_args( (array) $instance, array(
    167             'title' => 'Recent Posts',
    168             'numposts' => 5,
    169             'characters' => 100,
    170             'post_type' => '',
    171             'cat' => 0,
    172             'tag' => '',
    173             'thumb_width' => 55,
    174             'thumb_height' => 55,
    175             'linktext' => '',
    176             'linkurl' => '',
    177             'display_cats' => false,
    178             'display_tags' => false,
    179             'display_date' => false,
    180         )); ?>
    181 
    182         <p>
    183             <label for="<?php echo esc_html($this->get_field_id( 'title' )); ?>"><?php esc_html_e( 'Title:', 'recent-cpt' ); ?></label>
    184             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'title' )); ?>" name="<?php echo esc_html($this->get_field_name( 'title' )); ?>" type="text" value="<?php echo  esc_html($instance[ 'title' ]); ?>" />
    185         </p>
    186 
    187         <p>
    188             <label for="<?php echo esc_html($this->get_field_id( 'numposts' )); ?>"><?php  esc_html_e( 'Number of posts to show:', 'recent-cpt' ); ?></label>
    189             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'numposts' )); ?>" name="<?php echo esc_html($this->get_field_name( 'numposts' )); ?>" type="text" value="<?php echo  esc_html($instance[ 'numposts' ]); ?>" />
    190         </p>
    191 
    192         <p>
    193             <label for="<?php echo esc_html($this->get_field_id( 'characters' )); ?>"><?php  esc_html_e( 'Excerpt length in number of characters:', 'recent-cpt' ); ?></label>
    194             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'characters' )); ?>" name="<?php echo  esc_html($this->get_field_name( 'characters' )); ?>" type="text" value="<?php echo  esc_html($instance[ 'characters' ]); ?>" />
    195         </p>
    196 
    197         <p>
    198             <label for="<?php echo esc_html($this->get_field_id( 'post_type' )); ?>"><?php  esc_html_e( 'Custom post type:', 'recent-cpt' ); ?></label>
    199             <select id="<?php echo esc_html($this->get_field_id( 'post_type' )); ?>" name="<?php echo esc_html($this->get_field_name( 'post_type' )); ?>">
    200             <option value=""><?php echo esc_html(__( 'None', 'recent-cpt' )) . ' (' . esc_html(__( 'Posts', 'recent-cpt' )) . ')'; ?></option>
    201             <?php
    202                 $args_cpt = array(
    203                     'public' => true,
    204                     '_builtin' => false
    205                 );
    206                 $output = 'names';
    207                 $operator = 'and';
    208                 $post_types = get_post_types( $args_cpt, $output, $operator );
    209                 foreach ( $post_types  as $post_type ) {
    210                     echo wp_kses(
    211    '<option value="' . esc_attr($post_type) . '"' . selected( $instance[ 'post_type' ], $post_type, false ). '>' . esc_html($post_type) . '</option>',
    212    array( 'option' => array('value' => true, 'selected' => true) )
    213 );
    214                 }
    215             ?>
    216             </select>
    217         </p>
    218    
    219         <p>
    220             <label for="<?php echo esc_html($this->get_field_id( 'thumb_width' )); ?>"><?php  esc_html_e( 'Thumbnail Width:', 'recent-cpt' ); ?></label>
    221             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'thumb_width' )); ?>" name="<?php echo esc_html($this->get_field_name( 'thumb_width' )); ?>" type="text" value="<?php echo esc_html($instance[ 'thumb_width' ]); ?>" />
    222             <br /><small><?php esc_html_e( 'Enter Thumbnail width', 'recent-cpt' ); ?></small>
    223         </p>
    224    
    225   <p>
    226             <label for="<?php echo esc_html($this->get_field_id( 'thumb_height' )); ?>"><?php  esc_html_e( 'Thumbnail Height:', 'recent-cpt' ); ?></label>
    227             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'thumb_height' )); ?>" name="<?php echo esc_html($this->get_field_name( 'thumb_height' )); ?>" type="text" value="<?php echo esc_html($instance[ 'thumb_height' ]); ?>" />
    228             <br /><small><?php esc_html_e( 'Enter Thumbnail height', 'recent-cpt' ); ?></small>
    229         </p>
    230 
    231         <p>
    232             <label for="<?php echo esc_html($this->get_field_id( 'cat' )); ?>"><?php  esc_html_e( 'Limit to category: ', 'recent-cpt' ); ?>
    233             <?php
    234             wp_dropdown_categories(array(
    235                 'name' => $this->get_field_name( 'cat' ),
    236                 'show_option_all' => __( 'None (all categories)', 'recent-cpt' ),
    237                 'hide_empty' => 0,
    238                 'hierarchical' => 1,
    239                 'selected' => $instance[ 'cat' ]
    240             )); ?></label>
    241         </p>
    242 
    243         <p>
    244             <label for="<?php echo esc_html($this->get_field_id( 'tag' )); ?>"><?php  esc_html_e( 'Limit to tags:', 'recent-cpt' ); ?></label>
    245             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'tag' )); ?>" name="<?php echo esc_html($this->get_field_name( 'tag' )); ?>" type="text" value="<?php echo esc_html($instance[ 'tag' ]); ?>" />
    246             <br /><small><?php esc_html_e( 'Enter post tags separated by commas (\'country, city\' )', 'recent-cpt' ); ?></small>
    247         </p>
    248 
    249         <p>
    250             <input class="checkbox" type="checkbox" <?php checked( $instance['display_date'] ); ?> id="<?php echo $this->get_field_id( 'display_date' ); ?>" name="<?php echo $this->get_field_name( 'display_date' ); ?>" />
    251             <label for="<?php echo $this->get_field_id( 'display_date' ); ?>"><?php esc_html_e( 'Display Post Date?', 'recent-cpt' ); ?></label>
    252         </p>
    253         <p>
    254             <input class="checkbox" type="checkbox" <?php checked( $instance['display_cats'] ); ?> id="<?php echo $this->get_field_id( 'display_cats' ); ?>" name="<?php echo $this->get_field_name( 'display_cats' ); ?>" />
    255             <label for="<?php echo $this->get_field_id( 'display_cats' ); ?>"><?php esc_html_e( 'Display Categories?', 'recent-cpt' ); ?></label>
    256         </p>
    257         <p>
    258             <input class="checkbox" type="checkbox" <?php checked( $instance['display_tags'] ); ?> id="<?php echo $this->get_field_id( 'display_tags' ); ?>" name="<?php echo $this->get_field_name( 'display_tags' ); ?>" />
    259             <label for="<?php echo $this->get_field_id( 'display_tags' ); ?>"><?php esc_html_e( 'Display Tags?', 'recent-cpt' ); ?></label>
    260         </p>
    261 
    262         <p>
    263             <label for="<?php echo esc_html($this->get_field_id( 'linktext' )); ?>"><?php  esc_html_e( 'Link text:', 'recent-cpt' ); ?></label>
    264             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'linktext' )); ?>" name="<?php echo esc_html($this->get_field_name( 'linktext' )); ?>" type="text" value="<?php echo esc_html($instance[ 'linktext' ]); ?>" />
    265         </p>
    266 
    267         <p>
    268             <label for="<?php echo esc_html($this->get_field_id( 'linkurl' )); ?>"><?php  esc_html_e( 'URL:', 'recent-cpt' ); ?></label>
    269             <input class="widefat" id="<?php echo esc_html($this->get_field_id( 'linkurl' )); ?>" name="<?php echo esc_html($this->get_field_name( 'linkurl' )); ?>" type="text" value="<?php echo esc_html($instance[ 'linkurl' ]); ?>" />
    270         </p>
    271 
    272         <?php
    273     }
    274 }
    275 
    276 // Register the widget
    277 add_action( 'widgets_init', function() {
    278     register_widget( 'PI_RCWT_RecentCPTWidgetThumbnails' );
     196add_action('widgets_init', function(){
     197    register_widget('PI_RCWT_RecentCPTWidgetThumbnails');
    279198});
Note: See TracChangeset for help on using the changeset viewer.