Advanced Random Posts Widget - Version 2.0.5

Version Description

  • 07/12/2015 =
  • WordPress 4.3 support
  • Update: Remove ID in the widget markup to prevent duplicate ID
  • Update: Limit the number of tags and categories displayed in the widget
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

Files changed (5) hide show
  1. arpw.php +3 -2
  2. includes/form.php +2 -2
  3. includes/functions.php +1 -1
  4. includes/helpers.php +52 -0
  5. readme.txt +18 -14
arpw.php CHANGED
@@ -1,9 +1,9 @@
1
<?php
2
/**
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
@@ -102,6 +102,7 @@ class ARP_Widget {
102
require_once( ARPW_INC . 'resizer.php' );
103
require_once( ARPW_INC . 'functions.php' );
104
require_once( ARPW_INC . 'shortcode.php' );
105
}
106
107
/**
1
<?php
2
/**
3
* Plugin Name: Advanced Random Posts Widget
4
+ * Plugin URI: http://satrya.me/projects/advanced-random-posts-widget/
5
* Description: Easy to display random posts via shortcode or widget.
6
+ * Version: 2.0.5
7
* Author: Satrya
8
* Author URI: http://satrya.me/
9
* Author Email: satrya@satrya.me
102
require_once( ARPW_INC . 'resizer.php' );
103
require_once( ARPW_INC . 'functions.php' );
104
require_once( ARPW_INC . 'shortcode.php' );
105
+ require_once( ARPW_INC . 'helpers.php' );
106
}
107
108
/**
includes/form.php CHANGED
@@ -101,7 +101,7 @@
101
<?php _e( 'Limit to Category', 'arpw' ); ?>
102
</label>
103
<ul>
104
- <?php foreach ( get_terms( 'category' ) as $category ) : ?>
105
<li>
106
<input type="checkbox" value="<?php echo (int) $category->term_id; ?>" id="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>" name="<?php echo $this->get_field_name( 'cat' ); ?>[]" <?php checked( is_array( $instance['cat'] ) && in_array( $category->term_id, $instance['cat'] ) ); ?> />
107
<label for="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>">
@@ -117,7 +117,7 @@
117
<?php _e( 'Limit to Tag', 'arpw' ); ?>
118
</label>
119
<ul>
120
- <?php foreach ( get_terms( 'post_tag' ) as $post_tag ) : ?>
121
<li>
122
<input type="checkbox" value="<?php echo (int) $post_tag->term_id; ?>" id="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>" name="<?php echo $this->get_field_name( 'tag' ); ?>[]" <?php checked( is_array( $instance['tag'] ) && in_array( $post_tag->term_id, $instance['tag'] ) ); ?> />
123
<label for="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>">
101
<?php _e( 'Limit to Category', 'arpw' ); ?>
102
</label>
103
<ul>
104
+ <?php foreach ( arpw_cats_list() as $category ) : ?>
105
<li>
106
<input type="checkbox" value="<?php echo (int) $category->term_id; ?>" id="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>" name="<?php echo $this->get_field_name( 'cat' ); ?>[]" <?php checked( is_array( $instance['cat'] ) && in_array( $category->term_id, $instance['cat'] ) ); ?> />
107
<label for="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>">
117
<?php _e( 'Limit to Tag', 'arpw' ); ?>
118
</label>
119
<ul>
120
+ <?php foreach ( arpw_tags_list() as $post_tag ) : ?>
121
<li>
122
<input type="checkbox" value="<?php echo (int) $post_tag->term_id; ?>" id="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>" name="<?php echo $this->get_field_name( 'tag' ); ?>[]" <?php checked( is_array( $instance['tag'] ) && in_array( $post_tag->term_id, $instance['tag'] ) ); ?> />
123
<label for="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>">
includes/functions.php CHANGED
@@ -91,7 +91,7 @@ function arpw_get_random_posts( $args = array() ) {
91
92
if ( $posts->have_posts() ) :
93
94
- $html = '<div id="arpw-random-posts" class="arpw-random-' . sanitize_html_class( $args['post_type'] ) . ' ' . sanitize_html_class( $args['css_class'] ) . '">';
95
96
$html .= '<ul class="arpw-ul">';
97
91
92
if ( $posts->have_posts() ) :
93
94
+ $html = '<div class="arpw-random-' . sanitize_html_class( $args['post_type'] ) . ' ' . sanitize_html_class( $args['css_class'] ) . '">';
95
96
$html .= '<ul class="arpw-ul">';
97
includes/helpers.php ADDED
@@ -0,0 +1,52 @@
1
+ <?php
2
+ /**
3
+ * Function helper
4
+ *
5
+ * @package Advanced_Random_Posts_Widget
6
+ * @since 2.0.5
7
+ * @author Satrya
8
+ * @copyright Copyright (c) 2015, Satrya
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Display list of tags for widget.
14
+ *
15
+ * @since 2.0.5
16
+ */
17
+ function arpw_tags_list() {
18
+
19
+ // Arguments
20
+ $args = array(
21
+ 'number' => 99
22
+ );
23
+
24
+ // Allow dev to filter the arguments
25
+ $args = apply_filters( 'arpw_tags_list_args', $args );
26
+
27
+ // Get the tags
28
+ $tags = get_terms( 'post_tag', $args );
29
+
30
+ return $tags;
31
+ }
32
+
33
+ /**
34
+ * Display list of categories for widget.
35
+ *
36
+ * @since 2.0.5
37
+ */
38
+ function arpw_cats_list() {
39
+
40
+ // Arguments
41
+ $args = array(
42
+ 'number' => 99
43
+ );
44
+
45
+ // Allow dev to filter the arguments
46
+ $args = apply_filters( 'arpw_cats_list_args', $args );
47
+
48
+ // Get the cats
49
+ $cats = get_terms( 'category', $args );
50
+
51
+ return $cats;
52
+ }
readme.txt CHANGED
@@ -1,10 +1,9 @@
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
@@ -14,8 +13,6 @@ Provides flexible and advanced random posts. Display it via shortcode or widget
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:
21
@@ -43,7 +40,12 @@ Before asking a support question:
43
44
= Image Sizes Issue =
45
46
- This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to fix the image size.
47
48
= Support =
49
@@ -52,7 +54,7 @@ This plugin creates custom image sizes. If you use images that were uploaded to
52
* Submit translation.
53
54
= Plugin Info =
55
- * Developed by [Satrya](http://satrya.me/) & [Theme Junkie](http://www.theme-junkie.com/)
56
* Check out the [Github](https://github.com/satrya/advanced-random-posts-widget) repo to contribute.
57
58
= Posts Plugin Series =
@@ -89,7 +91,7 @@ Your theme needs to support Post Thumbnail, please go to http://codex.wordpress.
89
By default it uses **arpw-thumbnail** which have **50x50** size. If you want to use custom image size, you can install http://wordpress.org/plugins/simple-image-sizes/ then create new image size, it will appear in the **Thumbnail Size** selectbox in the widget option.
90
91
= Thumbnail Size Not Working Properly =
92
- I have mentioned it in the plugin description. If you use images that were uploaded to the media library before you installed this plugin and/or you have your own custom image sizes, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to fix the image size.
93
94
= How to add custom style? =
95
The plugin comes with a very basic style, if you want to add custom style please do `wp_dequeue_style` to remove the default stylesheet. Place the code below in your theme `functions.php`.
@@ -101,9 +103,6 @@ add_action( 'wp_enqueue_scripts', 'prefix_remove_arpw_style', 10 );
101
`
102
Then you can add your custom style using Custom CSS plugin or in your theme `style.css`. Here's the plugin selector
103
`
104
- /* wrapper */
105
- #arpw-random-posts {}
106
-
107
/* ul */
108
.arpw-ul {}
109
@@ -169,7 +168,12 @@ after=""
169
170
== Changelog ==
171
172
- = 2.0.4 - 11/04/2015 =
173
* WordPress 4.1.1 support.
174
* **Add:** Add Custom CSS textarea.
175
1
=== Advanced Random Posts Widget ===
2
+ Contributors: satrya
3
Tags: random posts, thumbnail, widget, widgets, sidebar, excerpt, category, post tag, post type, taxonomy, shortcode, multiple widgets
4
+ Requires at least: 4.0
5
+ Tested up to: 4.3
6
+ Stable tag: 2.0.5
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
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:
18
40
41
= Image Sizes Issue =
42
43
+ This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](https://wordpress.org/plugins/force-regenerate-thumbnails/) plugin to fix the image size.
44
+
45
+ = Language =
46
+ * English
47
+ * Bahasa Indonesia
48
+ * [Please contibute to submit your language](http://satrya.me/projects/advanced-random-posts-widget/)
49
50
= Support =
51
54
* Submit translation.
55
56
= Plugin Info =
57
+ * Developed by [Satrya](http://satrya.me/)
58
* Check out the [Github](https://github.com/satrya/advanced-random-posts-widget) repo to contribute.
59
60
= Posts Plugin Series =
91
By default it uses **arpw-thumbnail** which have **50x50** size. If you want to use custom image size, you can install http://wordpress.org/plugins/simple-image-sizes/ then create new image size, it will appear in the **Thumbnail Size** selectbox in the widget option.
92
93
= Thumbnail Size Not Working Properly =
94
+ I have mentioned it in the plugin description. If you use images that were uploaded to the media library before you installed this plugin and/or you have your own custom image sizes, please install [Regenerate Thumbnails](https://wordpress.org/plugins/force-regenerate-thumbnails/) plugin to fix the image size.
95
96
= How to add custom style? =
97
The plugin comes with a very basic style, if you want to add custom style please do `wp_dequeue_style` to remove the default stylesheet. Place the code below in your theme `functions.php`.
103
`
104
Then you can add your custom style using Custom CSS plugin or in your theme `style.css`. Here's the plugin selector
105
`
106
/* ul */
107
.arpw-ul {}
108
168
169
== Changelog ==
170
171
+ = 2.0.5 - 07/12/2015 =
172
+ * WordPress 4.3 support
173
+ * **Update:** Remove `ID` in the widget markup to prevent duplicate ID
174
+ * **Update:** Limit the number of `tags` and `categories` displayed in the widget
175
+
176
+ = 2.0.4 - 04/1/2015 =
177
* WordPress 4.1.1 support.
178
* **Add:** Add Custom CSS textarea.
179