Category Posts Widget - Version 2.1

Version Description

Download this release

Release Info

Developer ZephyrWest
Plugin Icon 128x128 Category Posts Widget
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

Files changed (2) hide show
  1. cat-posts.php +9 -3
  2. readme.txt +5 -1
cat-posts.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  Plugin Name: Category Posts Widget
4
- Plugin URI: http://jameslao.com/
5
  Description: Adds a widget that can display a specified number of posts from a single category. Can also set how many widgets to show.
6
  Author: James Lao
7
- Version: 2.0
8
  Author URI: http://jameslao.com/
9
  */
10
 
@@ -26,9 +26,12 @@ function widget($args, $instance) {
26
  $instance["title"] = $category_info->name;
27
  }
28
 
 
 
 
29
  // Get array of post info.
30
  query_posts("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]);
31
- global $post; // So we can get the post ID
32
 
33
  echo $before_widget;
34
 
@@ -64,6 +67,9 @@ function widget($args, $instance) {
64
  echo "</ul>\n";
65
 
66
  echo $after_widget;
 
 
 
67
  }
68
 
69
  /**
1
  <?php
2
  /*
3
  Plugin Name: Category Posts Widget
4
+ Plugin URI: http://jameslao.com/2009/07/29/category-posts-widget-2-0/
5
  Description: Adds a widget that can display a specified number of posts from a single category. Can also set how many widgets to show.
6
  Author: James Lao
7
+ Version: 2.1
8
  Author URI: http://jameslao.com/
9
  */
10
 
26
  $instance["title"] = $category_info->name;
27
  }
28
 
29
+ // Save old query...
30
+ $old_query = $wp_query;
31
+
32
  // Get array of post info.
33
  query_posts("showposts=" . $instance["num"] . "&cat=" . $instance["cat"]);
34
+ global $post, $wp_query; // So we can get the post ID
35
 
36
  echo $before_widget;
37
 
67
  echo "</ul>\n";
68
 
69
  echo $after_widget;
70
+
71
+ // Won't even know I was here...
72
+ $wp_query = $old_query;
73
  }
74
 
75
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://jameslao.com/
4
  Tags: category, posts, widget
5
  Requires at least: 2.8
6
  Tested up to: 2.8.2
7
- Stable tag: 2.0
8
 
9
  Adds a widget that shows the most recent posts in a single category.
10
 
@@ -30,6 +30,10 @@ Features:
30
 
31
  == Changelog ==
32
 
 
 
 
 
33
  2.0
34
 
35
  * Updated to use the WP 2.8 widget API.
4
  Tags: category, posts, widget
5
  Requires at least: 2.8
6
  Tested up to: 2.8.2
7
+ Stable tag: 2.1
8
 
9
  Adds a widget that shows the most recent posts in a single category.
10
 
30
 
31
  == Changelog ==
32
 
33
+ 2.1
34
+
35
+ * Fixed bug where wp_query global was getting over written.
36
+
37
  2.0
38
 
39
  * Updated to use the WP 2.8 widget API.