Advanced Random Posts Widget - Version 2.0.4

Version Description

  • 11/04/2015 =
  • WordPress 4.1.1 support.
  • Add: Add Custom CSS textarea.
Download this release

Release Info

Developer satrya
Plugin Icon 128x128 Advanced Random Posts Widget
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.0.3 to 2.0.4

Files changed (5) hide show
  1. arpw.php +1 -1
  2. classes/widget.php +1 -0
  3. includes/form.php +9 -1
  4. includes/functions.php +18 -3
  5. readme.txt +11 -5
arpw.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Advanced Random Posts Widget
4
* Plugin URI: http://wordpress.org/plugins/advanced-random-posts-widget/
5
* Description: Easy to display random posts via shortcode or widget.
6
- * Version: 2.0.3
7
* Author: Satrya
8
* Author URI: http://satrya.me/
9
* Author Email: satrya@satrya.me
3
* Plugin Name: Advanced Random Posts Widget
4
* Plugin URI: http://wordpress.org/plugins/advanced-random-posts-widget/
5
* Description: Easy to display random posts via shortcode or widget.
6
+ * Version: 2.0.4
7
* Author: Satrya
8
* Author URI: http://satrya.me/
9
* Author Email: satrya@satrya.me
classes/widget.php CHANGED
@@ -99,6 +99,7 @@ class Advanced_Random_Posts_Widget extends WP_Widget {
99
$instance['date'] = isset( $new_instance['date'] ) ? (bool) $new_instance['date'] : false;
100
$instance['date_relative'] = isset( $new_instance['date_relative'] ) ? (bool) $new_instance['date_relative'] : false;
101
102
$instance['css_class'] = sanitize_html_class( $new_instance['css_class'] );
103
$instance['before'] = stripslashes( $new_instance['before'] );
104
$instance['after'] = stripslashes( $new_instance['after'] );
99
$instance['date'] = isset( $new_instance['date'] ) ? (bool) $new_instance['date'] : false;
100
$instance['date_relative'] = isset( $new_instance['date_relative'] ) ? (bool) $new_instance['date_relative'] : false;
101
102
+ $instance['css'] = $new_instance['css'];
103
$instance['css_class'] = sanitize_html_class( $new_instance['css_class'] );
104
$instance['before'] = stripslashes( $new_instance['before'] );
105
$instance['after'] = stripslashes( $new_instance['after'] );
includes/form.php CHANGED
@@ -221,4 +221,12 @@
221
222
</div>
223
224
- <div class="clear"></div>
221
222
</div>
223
224
+ <div class="clear"></div>
225
+
226
+ <p>
227
+ <label for="<?php echo $this->get_field_id( 'css' ); ?>">
228
+ <?php _e( 'Custom CSS', 'arpw' ); ?>
229
+ </label>
230
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'css' ); ?>" name="<?php echo $this->get_field_name( 'css' ); ?>" style="height:180px;"><?php echo $instance['css']; ?></textarea>
231
+ <small><?php printf( __( 'You can find the plugin css selector on %1$sFAQ page%2$s.' ), '<a href="https://wordpress.org/plugins/advanced-random-posts-widget/faq/" target="_blank">', '</a>' ); ?></small>
232
+ </p>
includes/functions.php CHANGED
@@ -42,6 +42,7 @@ function arpw_get_default_args() {
42
'date' => false,
43
'date_relative' => false,
44
45
'css_class' => '',
46
'before' => '',
47
'after' => ''
@@ -83,7 +84,7 @@ function arpw_get_random_posts( $args = array() ) {
83
extract( $args );
84
85
// Allow devs to hook in stuff before the loop.
86
- do_action( 'arpw_before_loop' );
87
88
// Get the posts query.
89
$posts = arpw_get_posts( $args );
@@ -172,7 +173,7 @@ function arpw_get_random_posts( $args = array() ) {
172
wp_reset_postdata();
173
174
// Allow devs to hook in stuff after the loop.
175
- do_action( 'arpw_after_loop' );
176
177
// Return the related posts markup.
178
return $args['before'] . $html . $args['after'];
@@ -238,4 +239,18 @@ function arpw_get_posts( $args = array() ) {
238
239
return $posts;
240
241
- }
42
'date' => false,
43
'date_relative' => false,
44
45
+ 'css' => '',
46
'css_class' => '',
47
'before' => '',
48
'after' => ''
84
extract( $args );
85
86
// Allow devs to hook in stuff before the loop.
87
+ do_action( 'arpw_before_loop', $args );
88
89
// Get the posts query.
90
$posts = arpw_get_posts( $args );
173
wp_reset_postdata();
174
175
// Allow devs to hook in stuff after the loop.
176
+ do_action( 'arpw_after_loop', $args );
177
178
// Return the related posts markup.
179
return $args['before'] . $html . $args['after'];
239
240
return $posts;
241
242
+ }
243
+
244
+ /**
245
+ * Custom CSS
246
+ *
247
+ * @since 2.0.4
248
+ */
249
+ function arpw_custom_css( $args ) {
250
+
251
+ if ( ! empty( $args['css'] ) ) {
252
+ echo '<style>' . $args['css'] . '</style>';
253
+ }
254
+
255
+ }
256
+ add_action( 'arpw_before_loop', 'arpw_custom_css', 1 );
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
=== Advanced Random Posts Widget ===
2
Contributors: satrya, themejunkie
3
Tags: random posts, thumbnail, widget, widgets, sidebar, excerpt, category, post tag, post type, taxonomy, shortcode, multiple widgets
4
Requires at least: 3.7
5
- Tested up to: 4.1
6
- Stable tag: 2.0.3
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -11,7 +12,9 @@ Provides flexible and advanced random posts. Display it via shortcode or widget
11
12
== Description ==
13
14
- This plugin will enable a custom, flexible and advanced random posts. It allows you to display a list of random posts via shortcode or widget with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy.
15
16
= Important! =
17
Before asking a support question:
@@ -21,7 +24,6 @@ Before asking a support question:
21
22
= Features Include =
23
24
- * WordPress 4.1 Support.
25
* Allow you to set title url.
26
* Display thumbnails, with customizable size and alignment.
27
* Display excerpt, with customizable length.
@@ -167,7 +169,11 @@ after=""
167
168
== Changelog ==
169
170
- = 2.0.3 - 4/01/2015
171
* WordPress 4.1 support.
172
* **Update:** Language.
173
* **Add:** Bahasa Indonesia translation.
1
=== Advanced Random Posts Widget ===
2
Contributors: satrya, themejunkie
3
+ Donate link: http://satrya.me/donate/
4
Tags: random posts, thumbnail, widget, widgets, sidebar, excerpt, category, post tag, post type, taxonomy, shortcode, multiple widgets
5
Requires at least: 3.7
6
+ Tested up to: 4.1.1
7
+ Stable tag: 2.0.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
12
13
== Description ==
14
15
+ This plugin will enable a custom, flexible and advanced random posts. It allows you to display a list of random posts via shortcode or widget with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy.
16
+
17
+ **If you find this plugin useful for you, I will really appreciate if you could spare a couple of bucks to help me to pay my web hosting bill.** [Donate here](http://satrya.me/donate/).
18
19
= Important! =
20
Before asking a support question:
24
25
= Features Include =
26
27
* Allow you to set title url.
28
* Display thumbnails, with customizable size and alignment.
29
* Display excerpt, with customizable length.
169
170
== Changelog ==
171
172
+ = 2.0.4 - 11/04/2015 =
173
+ * WordPress 4.1.1 support.
174
+ * **Add:** Add Custom CSS textarea.
175
+
176
+ = 2.0.3 - 4/01/2015 =
177
* WordPress 4.1 support.
178
* **Update:** Language.
179
* **Add:** Bahasa Indonesia translation.