Changeset 1219952
- Timestamp:
- 08/13/2015 12:44:34 PM (11 years ago)
- Location:
- recent-posts-by-category-widget/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
recent-posts-by-category-widget.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
recent-posts-by-category-widget/trunk/readme.txt
r995198 r1219952 27 27 == Changelog == 28 28 29 = 1.2 = 30 * Switch to PHP5 style constructors for WP v4.3 31 29 32 = 1.1 = 30 33 * Better use of 'widget_title' filter to allow hooks to be used on it. -
recent-posts-by-category-widget/trunk/recent-posts-by-category-widget.php
r995198 r1219952 4 4 Plugin Name: Recent Posts by Category Widget 5 5 Description: Just like the default Recent Posts widget except you can choose a category to pull posts from. 6 Version: 1. 16 Version: 1.2 7 7 Author: Ross Cornell 8 8 Author URI: http://www.rosscornell.com … … 13 13 // Register widget 14 14 15 add_action( 'widgets_init', 'rpjc_register_widget_cat_recent_posts' ); 16 17 function rpjc_register_widget_cat_recent_posts() { 18 19 register_widget( 'rpjc_widget_cat_recent_posts' ); 20 21 } 15 add_action( 'widgets_init', function() { register_widget( 'rpjc_widget_cat_recent_posts' ); } ); 22 16 23 17 class rpjc_widget_cat_recent_posts extends WP_Widget { 24 18 25 // Process widget 26 27 function rpjc_widget_cat_recent_posts() { 19 public function __construct() { 28 20 29 $widget_ops = array( 30 31 'classname' => 'rpjc_widget_cat_recent_posts widget_recent_entries', 32 'description' => 'Display recent blog posts from a specific category' 33 21 parent::__construct( 22 23 'rpjc_widget_cat_recent_posts', 24 __( 'Recent Posts by Category', 'recent-posts-by-category-widget' ), 25 array( 26 'classname' => 'rpjc_widget_cat_recent_posts widget_recent_entries', 27 'description' => __( 'Display recent blog posts from a specific category', 'recent-posts-by-category-widget' ) 28 ) 29 34 30 ); 35 36 $this->WP_Widget( 'rpjc_widget_cat_recent_posts', __( 'Recent Posts by Category' ), $widget_ops );37 31 38 32 } 39 33 40 34 // Build the widget settings form 41 35 … … 57 51 58 52 <p> 59 <label for="rpjc_widget_cat_recent_posts_ username"><?php _e( 'Category' ); ?>:</label>53 <label for="rpjc_widget_cat_recent_posts_category"><?php _e( 'Category' ); ?>:</label> 60 54 61 55 <?php … … 112 106 echo $before_widget; 113 107 114 $title = $title =apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );108 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); 115 109 $category = $instance['category']; 116 110 $number = $instance['number']; … … 146 140 } else { 147 141 148 echo 'No posts yet...';142 _e( 'No posts yet.', 'recent-posts-by-category-widget' ); 149 143 150 144 }
Note: See TracChangeset
for help on using the changeset viewer.