Version Description
- Fixed several pesky PHP notices. (Props: @eeb1)
Download this release
Release Info
Developer | dpe415 |
Plugin | Flexible Posts Widget |
Version | 3.1.2 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.1.2
- flexible-posts-widget.php +10 -10
- readme.txt +13 -15
- views/admin.php +1 -1
flexible-posts-widget.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Flexible Posts Widget
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
|
5 |
Author: dpe415
|
6 |
Author URI: http://dpedesign.com
|
7 |
-
Version: 3.1
|
8 |
Description: An advanced posts display widget with many options: get posts by post type, taxonomy & term; sorting & ordering; feature images; custom templates and more.
|
9 |
License: GPL2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -32,7 +32,7 @@ if( !defined('ABSPATH') )
|
|
32 |
|
33 |
// Define our version number
|
34 |
if( !defined('DPE_FP_Version') )
|
35 |
-
define( 'DPE_FP_Version', '3.1' );
|
36 |
|
37 |
/**
|
38 |
* Plugin Initialization
|
@@ -210,14 +210,14 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
|
|
210 |
$instance['posttype'] = $posttypes;
|
211 |
$instance['taxonomy'] = $taxonomy;
|
212 |
$instance['term'] = $terms;
|
213 |
-
$instance['number'] = (int)$new_instance['number'];
|
214 |
-
$instance['offset'] = (int)$new_instance['offset'];
|
215 |
$instance['orderby'] = ( array_key_exists( $new_instance['orderby'], $this->orderbys ) ? $new_instance['orderby'] : 'date' );
|
216 |
$instance['order'] = ( array_key_exists( $new_instance['order'], $this->orders ) ? $new_instance['order'] : 'DESC' );
|
217 |
-
$instance['thumbnail'] = (
|
218 |
-
$instance['thumbsize'] = (in_array ( $new_instance['thumbsize'], $this->thumbsizes ) ? $new_instance['thumbsize'] : '' );
|
219 |
$instance['template'] = strip_tags( $new_instance['template'] );
|
220 |
-
$instance['cur_tab'] = (int)
|
221 |
|
222 |
return $instance;
|
223 |
|
@@ -259,7 +259,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
|
|
259 |
'offset' => '0',
|
260 |
'orderby' => 'date',
|
261 |
'order' => 'DESC',
|
262 |
-
'thumbnail' =>
|
263 |
'thumbsize' => '',
|
264 |
'template' => 'widget.php',
|
265 |
'cur_tab' => '0',
|
@@ -276,7 +276,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
|
|
276 |
* 2) parent template, 3) plugin resources. will look in the flexible-posts-widget/
|
277 |
* directory in a theme and the views/ directory in the plugin
|
278 |
*
|
279 |
-
*
|
280 |
* by Matt Wiebe at Modern Tribe, Inc.
|
281 |
* http://wordpress.org/extend/plugins/image-widget/
|
282 |
*
|
@@ -286,7 +286,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
|
|
286 |
public function getTemplateHierarchy( $template ) {
|
287 |
|
288 |
// whether or not .php was added
|
289 |
-
$template_slug =
|
290 |
$template = $template_slug . '.php';
|
291 |
|
292 |
if ( $theme_file = locate_template( array( 'flexible-posts-widget/' . $template ) ) ) {
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
|
5 |
Author: dpe415
|
6 |
Author URI: http://dpedesign.com
|
7 |
+
Version: 3.1.2
|
8 |
Description: An advanced posts display widget with many options: get posts by post type, taxonomy & term; sorting & ordering; feature images; custom templates and more.
|
9 |
License: GPL2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
32 |
|
33 |
// Define our version number
|
34 |
if( !defined('DPE_FP_Version') )
|
35 |
+
define( 'DPE_FP_Version', '3.1.2' );
|
36 |
|
37 |
/**
|
38 |
* Plugin Initialization
|
210 |
$instance['posttype'] = $posttypes;
|
211 |
$instance['taxonomy'] = $taxonomy;
|
212 |
$instance['term'] = $terms;
|
213 |
+
$instance['number'] = (int) $new_instance['number'];
|
214 |
+
$instance['offset'] = (int) $new_instance['offset'];
|
215 |
$instance['orderby'] = ( array_key_exists( $new_instance['orderby'], $this->orderbys ) ? $new_instance['orderby'] : 'date' );
|
216 |
$instance['order'] = ( array_key_exists( $new_instance['order'], $this->orders ) ? $new_instance['order'] : 'DESC' );
|
217 |
+
$instance['thumbnail'] = ( isset( $new_instance['thumbnail'] ) ? (int) $new_instance['thumbnail'] : '0' );
|
218 |
+
$instance['thumbsize'] = ( in_array ( $new_instance['thumbsize'], $this->thumbsizes ) ? $new_instance['thumbsize'] : '' );
|
219 |
$instance['template'] = strip_tags( $new_instance['template'] );
|
220 |
+
$instance['cur_tab'] = (int) $new_instance['cur_tab'];
|
221 |
|
222 |
return $instance;
|
223 |
|
259 |
'offset' => '0',
|
260 |
'orderby' => 'date',
|
261 |
'order' => 'DESC',
|
262 |
+
'thumbnail' => '0',
|
263 |
'thumbsize' => '',
|
264 |
'template' => 'widget.php',
|
265 |
'cur_tab' => '0',
|
276 |
* 2) parent template, 3) plugin resources. will look in the flexible-posts-widget/
|
277 |
* directory in a theme and the views/ directory in the plugin
|
278 |
*
|
279 |
+
* Based on a function in the amazing image-widget
|
280 |
* by Matt Wiebe at Modern Tribe, Inc.
|
281 |
* http://wordpress.org/extend/plugins/image-widget/
|
282 |
*
|
286 |
public function getTemplateHierarchy( $template ) {
|
287 |
|
288 |
// whether or not .php was added
|
289 |
+
$template_slug = preg_replace( '/.php$/', '', $template );
|
290 |
$template = $template_slug . '.php';
|
291 |
|
292 |
if ( $theme_file = locate_template( array( 'flexible-posts-widget/' . $template ) ) ) {
|
readme.txt
CHANGED
@@ -4,14 +4,13 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.5.1
|
7 |
-
Stable tag: 3.1
|
8 |
License: GPL2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
An advanced posts display widget with many options. Display posts in your sidebars any way you'd like!
|
12 |
|
13 |
== Description ==
|
14 |
-
|
15 |
The default Recent Posts widget is exceptionally basic. I always find myself in need of a way to easily display a selection of posts from any combination post type or taxonomy. Hence, Flexible Post Widget.
|
16 |
|
17 |
Flexible Posts Widget (FPW) is more than just a simple alternative to the default Recent Posts widget. With many per-instance options it is highly customizable and allows advanced users to display the resulting posts virtually any way imaginable.
|
@@ -19,7 +18,6 @@ Flexible Posts Widget (FPW) is more than just a simple alternative to the defaul
|
|
19 |
Version 3.0 is a major enhancement as widgets can now get posts by *BOTH* post type and/or taxonomy & term as well as select *multiple* post types and terms. Previous versions of the plugin only allowed post type OR taxonomy & term queries, not both.
|
20 |
|
21 |
= Features & options =
|
22 |
-
|
23 |
* Customizable widget title
|
24 |
* Get posts via post type(s) and/or taxonomy & term(s).
|
25 |
* Control the number of posts displayed and the number of posts to offset.
|
@@ -28,20 +26,17 @@ Version 3.0 is a major enhancement as widgets can now get posts by *BOTH* post t
|
|
28 |
* Order posts by: date, ID, title, menu order, random; and sort posts: ascending or descending.
|
29 |
* Each widget's output can be customized by user-defined templates added to the current theme folder.
|
30 |
|
31 |
-
|
32 |
-
|
33 |
* English
|
34 |
* Spanish
|
35 |
|
36 |
|
37 |
== Installation ==
|
38 |
-
|
39 |
1. Upload the `flexible-posts-widget` folder to the `/wp-content/plugins/` directory.
|
40 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
41 |
1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
|
42 |
|
43 |
= To use a custom HTML output template =
|
44 |
-
|
45 |
1. Create a folder called `flexible-posts-widget` in the root of your theme folder.
|
46 |
1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
|
47 |
1. Optional: Rename your theme's `widget.php` template file to a name of your choice (to use different templates for each widget instance).
|
@@ -50,7 +45,6 @@ Version 3.0 is a major enhancement as widgets can now get posts by *BOTH* post t
|
|
50 |
|
51 |
|
52 |
== Frequently Asked Questions ==
|
53 |
-
|
54 |
= How can I display custom fields (custom meta values) with FPW? =
|
55 |
You'll want to create a custom HTML template by following [the instructions](http://wordpress.org/extend/plugins/flexible-posts-widget/installation/ "View instructions for creating custom FPW templates") and then you can use the standard WordPress [Custom Field](http://codex.wordpress.org/Custom_Fields "View custom field functions on the WordPress Codex") functions the same way you would if you were editing your theme's other template files.
|
56 |
|
@@ -64,12 +58,14 @@ FPW intentionally does NOT add any styling of it's own. To adjust the font size
|
|
64 |
= Does this plugin/widget insert any styles or scripts into my site? =
|
65 |
FPW does not add styles or scripts to your public theme. The plugin is intentionally designed to work within your existing theme. FPW does add one stylesheet and one JavaScript to the Widgets page in wp-admin to help with the administration of any FPWs in use.
|
66 |
|
|
|
|
|
|
|
67 |
= Questions, Support & Bug Reports =
|
68 |
-
To get answers to your questions, request help or submit a bug report, please
|
69 |
|
70 |
|
71 |
== Screenshots ==
|
72 |
-
|
73 |
1. Configuring a Flexible Posts Widget in wp-admin with the Post Type tab displayed.
|
74 |
1. Configuring a Flexible Posts Widget in wp-admin with the Taxonomy & Term tab displayed.
|
75 |
1. An example of posts displayed using WordPress's TwentyTwelve theme and the default Feature Image (post-thumbnail) size. This demonstrates how the plugin looks out-of-the-box with no user-customized styling or output in a default theme.
|
@@ -78,17 +74,14 @@ To get answers to your questions, request help or submit a bug report, please vi
|
|
78 |
1. In the wild: FPW displaying several posts over at http://chnl7700.mnsu.edu. Also highly customized output and theme styles.
|
79 |
|
80 |
== Upgrade Notice ==
|
81 |
-
|
82 |
When upgrading from one major version to another (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
|
83 |
|
84 |
|
85 |
== Other Notes ==
|
86 |
-
|
87 |
= Upgrading from one major version to another =
|
88 |
When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
|
89 |
|
90 |
= Default vs. Custom Templates =
|
91 |
-
|
92 |
FPW comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called `flexible-posts-widget` in your template directory and copy over the "views/widget.php" file.
|
93 |
|
94 |
Edit the new file in your theme to your desired HTML layout. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release.
|
@@ -103,8 +96,14 @@ Edit the new file in your theme to your desired HTML layout. Please do not edit
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 3.1 =
|
107 |
-
* Internationalized and added Spanish. (Props: @elarequi)
|
108 |
* Added support for Media post types with "image/" mime types to be displayed directly in the default template.
|
109 |
|
110 |
= 3.0.2 =
|
@@ -114,7 +113,6 @@ Edit the new file in your theme to your desired HTML layout. Please do not edit
|
|
114 |
* Bug fix: Not able to get all registered post types & taxonomies until after widget init. Had to reorder some code.
|
115 |
* Bug fix: when getting post types for display in widget admin. (Props: @angelfish276)
|
116 |
|
117 |
-
|
118 |
= 3.0 =
|
119 |
* Allow widgets to query by post type and/or taxonomy & term instead of just one or the other. (Props: @vernal)
|
120 |
* Allow widgets to query by multiple post types and multiple terms within the same taxonomy. (Props: @vernal)
|
4 |
Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.5.1
|
7 |
+
Stable tag: 3.1.2
|
8 |
License: GPL2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
An advanced posts display widget with many options. Display posts in your sidebars any way you'd like!
|
12 |
|
13 |
== Description ==
|
|
|
14 |
The default Recent Posts widget is exceptionally basic. I always find myself in need of a way to easily display a selection of posts from any combination post type or taxonomy. Hence, Flexible Post Widget.
|
15 |
|
16 |
Flexible Posts Widget (FPW) is more than just a simple alternative to the default Recent Posts widget. With many per-instance options it is highly customizable and allows advanced users to display the resulting posts virtually any way imaginable.
|
18 |
Version 3.0 is a major enhancement as widgets can now get posts by *BOTH* post type and/or taxonomy & term as well as select *multiple* post types and terms. Previous versions of the plugin only allowed post type OR taxonomy & term queries, not both.
|
19 |
|
20 |
= Features & options =
|
|
|
21 |
* Customizable widget title
|
22 |
* Get posts via post type(s) and/or taxonomy & term(s).
|
23 |
* Control the number of posts displayed and the number of posts to offset.
|
26 |
* Order posts by: date, ID, title, menu order, random; and sort posts: ascending or descending.
|
27 |
* Each widget's output can be customized by user-defined templates added to the current theme folder.
|
28 |
|
29 |
+
= Supported Languages =
|
|
|
30 |
* English
|
31 |
* Spanish
|
32 |
|
33 |
|
34 |
== Installation ==
|
|
|
35 |
1. Upload the `flexible-posts-widget` folder to the `/wp-content/plugins/` directory.
|
36 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
37 |
1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
|
38 |
|
39 |
= To use a custom HTML output template =
|
|
|
40 |
1. Create a folder called `flexible-posts-widget` in the root of your theme folder.
|
41 |
1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
|
42 |
1. Optional: Rename your theme's `widget.php` template file to a name of your choice (to use different templates for each widget instance).
|
45 |
|
46 |
|
47 |
== Frequently Asked Questions ==
|
|
|
48 |
= How can I display custom fields (custom meta values) with FPW? =
|
49 |
You'll want to create a custom HTML template by following [the instructions](http://wordpress.org/extend/plugins/flexible-posts-widget/installation/ "View instructions for creating custom FPW templates") and then you can use the standard WordPress [Custom Field](http://codex.wordpress.org/Custom_Fields "View custom field functions on the WordPress Codex") functions the same way you would if you were editing your theme's other template files.
|
50 |
|
58 |
= Does this plugin/widget insert any styles or scripts into my site? =
|
59 |
FPW does not add styles or scripts to your public theme. The plugin is intentionally designed to work within your existing theme. FPW does add one stylesheet and one JavaScript to the Widgets page in wp-admin to help with the administration of any FPWs in use.
|
60 |
|
61 |
+
= Want to add support for another language? =
|
62 |
+
I'd love to support more languages. Feel free to post PO & MO files for your language to a [new forum thread](http://wordpress.org/tags/flexible-posts-widget/) and I'll get them added to the plugin.
|
63 |
+
|
64 |
= Questions, Support & Bug Reports =
|
65 |
+
To get answers to your questions, request help or submit a bug report, please start a [new forum thread](http://wordpress.org/tags/flexible-posts-widget/).
|
66 |
|
67 |
|
68 |
== Screenshots ==
|
|
|
69 |
1. Configuring a Flexible Posts Widget in wp-admin with the Post Type tab displayed.
|
70 |
1. Configuring a Flexible Posts Widget in wp-admin with the Taxonomy & Term tab displayed.
|
71 |
1. An example of posts displayed using WordPress's TwentyTwelve theme and the default Feature Image (post-thumbnail) size. This demonstrates how the plugin looks out-of-the-box with no user-customized styling or output in a default theme.
|
74 |
1. In the wild: FPW displaying several posts over at http://chnl7700.mnsu.edu. Also highly customized output and theme styles.
|
75 |
|
76 |
== Upgrade Notice ==
|
|
|
77 |
When upgrading from one major version to another (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
|
78 |
|
79 |
|
80 |
== Other Notes ==
|
|
|
81 |
= Upgrading from one major version to another =
|
82 |
When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
|
83 |
|
84 |
= Default vs. Custom Templates =
|
|
|
85 |
FPW comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called `flexible-posts-widget` in your template directory and copy over the "views/widget.php" file.
|
86 |
|
87 |
Edit the new file in your theme to your desired HTML layout. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release.
|
96 |
|
97 |
== Changelog ==
|
98 |
|
99 |
+
= 3.1.2 =
|
100 |
+
* Fixed several pesky PHP notices. (Props: @eeb1)
|
101 |
+
|
102 |
+
= 3.1.1 =
|
103 |
+
* Fixed incorrect use of rtrim in getTemplateHierarchy when getting custom template files. (Props: @mortenf)
|
104 |
+
|
105 |
= 3.1 =
|
106 |
+
* Internationalized and added Spanish language support. (Props: @elarequi)
|
107 |
* Added support for Media post types with "image/" mime types to be displayed directly in the default template.
|
108 |
|
109 |
= 3.0.2 =
|
113 |
* Bug fix: Not able to get all registered post types & taxonomies until after widget init. Had to reorder some code.
|
114 |
* Bug fix: when getting post types for display in widget admin. (Props: @angelfish276)
|
115 |
|
|
|
116 |
= 3.0 =
|
117 |
* Allow widgets to query by post type and/or taxonomy & term instead of just one or the other. (Props: @vernal)
|
118 |
* Allow widgets to query by multiple post types and multiple terms within the same taxonomy. (Props: @vernal)
|
views/admin.php
CHANGED
@@ -58,7 +58,7 @@ if ( !defined('ABSPATH') )
|
|
58 |
$terms = get_terms( $taxonomy, $args );
|
59 |
|
60 |
if( !empty( $terms ) ) {
|
61 |
-
$output
|
62 |
foreach ( $terms as $option ) {
|
63 |
$output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $option->slug ) . '" type="checkbox" name="' . $this->get_field_name('term') . '[]"' . checked( in_array( $option->slug, (array)$term ), true, false ) . ' /> ' . esc_html( $option->name ) . "</label></li>\n";
|
64 |
}
|
58 |
$terms = get_terms( $taxonomy, $args );
|
59 |
|
60 |
if( !empty( $terms ) ) {
|
61 |
+
$output = '<ul class="categorychecklist termschecklist form-no-clear">';
|
62 |
foreach ( $terms as $option ) {
|
63 |
$output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $option->slug ) . '" type="checkbox" name="' . $this->get_field_name('term') . '[]"' . checked( in_array( $option->slug, (array)$term ), true, false ) . ' /> ' . esc_html( $option->name ) . "</label></li>\n";
|
64 |
}
|