Advanced Random Posts Widget - Version 2.1.0

Version Description

  • Nov 06, 2015 =
  • UI Changes!
  • Filter arpw_query DEPRECATED
  • Change text domain to advanced-random-posts-widget
  • Remove title attribute in the post link
  • Sanitize after and before the posts with wp_kses_post, security purpose
  • Introducing new hook arpw_before_loop_WIDGETID & arpw_after_loop_WIDGETID
  • Inline default style, no more load extra file from the plugin
  • Sanitize Custom CSS, better security
Download this release

Release Info

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

Code changes from version 2.0.7 to 2.1.0

arpw.php CHANGED
@@ -1,155 +1,144 @@
1
<?php
2
/**
3
- * Plugin Name: Random Posts Widget Extended
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.7
7
- * Author: Satrya
8
- * Author URI: http://satrya.me/
9
- * Author Email: satrya@satrya.me
10
*
11
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
* or (at your option) any later version.
14
*
15
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
*
18
- * You should have received a copy of the GNU General Public License along with this program; if not, write
19
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
- *
21
- * @package Advanced_Random_Posts_Widget
22
- * @since 0.0.1
23
- * @author Satrya
24
- * @copyright Copyright (c) 2014, Satrya
25
- * @license http://www.gnu.org/licenses/gpl-2.0.html
26
*/
27
28
// Exit if accessed directly
29
if ( ! defined( 'ABSPATH' ) ) exit;
30
31
- class ARP_Widget {
32
-
33
- /**
34
- * PHP5 constructor method.
35
- *
36
- * @since 0.0.1
37
- */
38
- public function __construct() {
39
40
- // Set the constants needed by the plugin.
41
- add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
42
43
- // Internationalize the text strings used.
44
- add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
45
46
- // Load the functions files.
47
- add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
48
49
- // Load the admin style.
50
- add_action( 'admin_enqueue_scripts', array( &$this, 'admin_style' ) );
51
52
- // Register widget.
53
- add_action( 'widgets_init', array( &$this, 'register_widget' ) );
54
55
- // Register new image size.
56
- add_action( 'init', array( &$this, 'register_image_size' ) );
57
58
- // Enqueue the front-end style.
59
- add_action( 'wp_enqueue_scripts', array( &$this, 'plugin_style' ) );
60
61
- }
62
63
- /**
64
- * Defines constants used by the plugin.
65
- *
66
- * @since 0.0.1
67
- */
68
- public function constants() {
69
70
- // Set constant path to the plugin directory.
71
- define( 'ARPW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
72
73
- // Set the constant path to the plugin directory URI.
74
- define( 'ARPW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
75
76
- // Set the constant path to the includes directory.
77
- define( 'ARPW_INC', ARPW_DIR . trailingslashit( 'includes' ) );
78
79
- // Set the constant path to the classes directory.
80
- define( 'ARPW_CLASS', ARPW_DIR . trailingslashit( 'classes' ) );
81
82
- // Set the constant path to the assets directory.
83
- define( 'ARPW_ASSETS', ARPW_URI . trailingslashit( 'assets' ) );
84
85
- }
86
87
- /**
88
- * Loads the translation files.
89
- *
90
- * @since 0.0.1
91
- */
92
- public function i18n() {
93
- load_plugin_textdomain( 'arpw', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
94
- }
95
-
96
- /**
97
- * Loads the initial files needed by the plugin.
98
- *
99
- * @since 0.0.1
100
- */
101
- public function includes() {
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
- /**
109
- * Register custom style for the widget settings.
110
- *
111
- * @since 0.0.1
112
- */
113
- function admin_style() {
114
115
- // Check if current screen is Widgets page.
116
- if ( 'widgets' != get_current_screen()->base ) {
117
- return;
118
}
119
120
- // Loads the widget style.
121
- wp_enqueue_style( 'arpw-admin-style', trailingslashit( ARPW_ASSETS ) . 'css/arpw-admin.css', array(), null );
122
123
- }
124
125
- /**
126
- * Register the widget.
127
- *
128
- * @since 0.0.1
129
- */
130
- function register_widget() {
131
- require_once( ARPW_CLASS . 'widget.php' );
132
- register_widget( 'Advanced_Random_Posts_Widget' );
133
- }
134
135
- /**
136
- * Register new image size.
137
- *
138
- * @since 0.0.1
139
- */
140
- function register_image_size() {
141
- add_image_size( 'arpw-thumbnail', 50, 50, true );
142
- }
143
144
- /**
145
- * Enqueue front-end style.
146
- *
147
- * @since 0.0.1
148
- */
149
- function plugin_style() {
150
- wp_enqueue_style( 'arpw-style', trailingslashit( ARPW_ASSETS ) . 'css/arpw-frontend.css', array(), null );
151
}
152
153
- }
154
155
new ARP_Widget;
1
<?php
2
/**
3
+ * Plugin Name: Advanced Random Posts Widget
4
+ * Plugin URI: https://wordpress.org/plugins/advanced-random-posts-widget/
5
+ * Description: Easily to display advanced random posts via shortcode or widget.
6
+ * Version: 2.1.0
7
+ * Author: Theme Junkie
8
+ * Author URI: http://www.theme-junkie.com/
9
+ * Author Email: support@theme-junkie.com
10
*
11
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
* or (at your option) any later version.
14
*
15
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
*
18
+ * You should have received a copy of the GNU General Public License along with this program; if not, write
19
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
// Exit if accessed directly
23
if ( ! defined( 'ABSPATH' ) ) exit;
24
25
+ if ( ! class_exists( 'ARP_Widget' ) ) :
26
27
+ class ARP_Widget {
28
29
+ /**
30
+ * PHP5 constructor method.
31
+ *
32
+ * @since 0.0.1
33
+ */
34
+ public function __construct() {
35
36
+ // Set the constants needed by the plugin.
37
+ add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
38
39
+ // Internationalize the text strings used.
40
+ add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
41
42
+ // Load the functions files.
43
+ add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
44
45
+ // Register widget.
46
+ add_action( 'widgets_init', array( &$this, 'register_widget' ) );
47
48
+ // Register new image size.
49
+ add_action( 'init', array( &$this, 'register_image_size' ) );
50
51
+ // Enqueue the front-end style.
52
+ add_action( 'wp_enqueue_scripts', array( &$this, 'plugin_style' ) );
53
54
+ // Load the admin style.
55
+ add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ) );
56
+ add_action( 'customize_controls_enqueue_scripts', array( &$this, 'admin_scripts' ) );
57
58
+ }
59
60
+ /**
61
+ * Defines constants used by the plugin.
62
+ *
63
+ * @since 0.0.1
64
+ */
65
+ public function constants() {
66
67
+ // Set constant path to the plugin directory.
68
+ define( 'ARPW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
69
70
+ // Set the constant path to the plugin directory URI.
71
+ define( 'ARPW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
72
73
+ // Set the constant path to the includes directory.
74
+ define( 'ARPW_INC', ARPW_DIR . trailingslashit( 'includes' ) );
75
76
+ // Set the constant path to the assets directory.
77
+ define( 'ARPW_ASSETS', ARPW_URI . trailingslashit( 'assets' ) );
78
79
+ }
80
81
+ /**
82
+ * Loads the translation files.
83
+ *
84
+ * @since 0.0.1
85
+ */
86
+ public function i18n() {
87
+ load_plugin_textdomain( 'advanced-random-posts-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
88
+ }
89
90
+ /**
91
+ * Loads the initial files needed by the plugin.
92
+ *
93
+ * @since 0.0.1
94
+ */
95
+ public function includes() {
96
+ require_once( ARPW_INC . 'functions.php' );
97
+ require_once( ARPW_INC . 'resizer.php' );
98
+ require_once( ARPW_INC . 'posts.php' );
99
+ require_once( ARPW_INC . 'shortcode.php' );
100
+ require_once( ARPW_INC . 'widget.php' );
101
}
102
103
+ /**
104
+ * Register custom style for the widget settings.
105
+ *
106
+ * @since 0.0.1
107
+ */
108
+ function admin_scripts() {
109
+ wp_enqueue_style( 'arpw-admin-style', trailingslashit( ARPW_ASSETS ) . 'css/arpw-admin.css' );
110
+ wp_enqueue_script( 'arpw-admin-script', trailingslashit( ARPW_ASSETS ) . 'js/jquery-cookie.js', array( 'jquery-ui-tabs' ) );
111
+ }
112
113
+ /**
114
+ * Register the widget.
115
+ *
116
+ * @since 0.0.1
117
+ */
118
+ function register_widget() {
119
+ register_widget( 'Advanced_Random_Posts_Widget' );
120
+ }
121
122
+ /**
123
+ * Register new image size.
124
+ *
125
+ * @since 0.0.1
126
+ */
127
+ function register_image_size() {
128
+ add_image_size( 'arpw-thumbnail', 50, 50, true );
129
+ }
130
131
+ /**
132
+ * Enqueue front-end style.
133
+ *
134
+ * @since 0.0.1
135
+ */
136
+ function plugin_style() {
137
+ wp_register_style( 'arpw-style', trailingslashit( ARPW_ASSETS ) . 'css/arpw-frontend.css' );
138
+ }
139
140
}
141
142
+ endif;
143
144
new ARP_Widget;
assets/css/arpw-admin.css CHANGED
@@ -1,39 +1,58 @@
1
- .widgets-php .arpw-columns-3 {
2
- overflow: hidden;
3
- float: left;
4
- width: 31%;
5
- margin-right: 3.5%;
6
}
7
8
- .widgets-php .arpw-columns-3 select.widefat {
9
- width: 98.5%;
10
}
11
12
- .widgets-php .arpw-column-last {
13
- float: right;
14
- margin-right: 0;
15
}
16
17
- .widgets-php .arpw-columns-3 label {
18
- font-size: 11px;
19
}
20
21
- .widgets-php .arpw-columns-3 p small {
22
- color: #777;
23
- font-style: italic;
24
}
25
26
- .arpw-input-half {
27
- width: 47%;
28
}
29
30
- .arpw-block {
31
- display: block;
32
}
33
34
- label.input-checkbox {
35
- width: 100px;
36
- display: inline-block;
37
}
38
39
.arpw-multiple-check-form {
@@ -45,9 +64,21 @@ label.input-checkbox {
45
padding: 10px;
46
max-height: 110px;
47
overflow: auto;
48
- margin-top: 0;
49
}
50
51
.arpw-multiple-check-form ul li:last-child {
52
margin-bottom: 0;
53
}
1
+ .arpw-bg {
2
+ background-color: #f3f3f3;
3
}
4
5
+ .arpw-bg .widget-control-actions {
6
+ clear: both;
7
}
8
9
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav {
10
+ padding: 1em 0;
11
+ float: left;
12
+ width: 8em;
13
}
14
15
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav li {
16
+ clear: left;
17
+ width: 100%;
18
+ margin-bottom: 0;
19
+ padding: .8em 0 .8em 1em;
20
}
21
22
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav li.ui-state-focus {
23
+ box-shadow: none;
24
+ outline: none;
25
}
26
27
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav li a {
28
+ display:block;
29
+ text-decoration: none;
30
}
31
32
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav li a:focus {
33
+ box-shadow: none;
34
}
35
36
+ .arpw-form-tabs.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active {
37
+ background-color: #fff;
38
+ }
39
+
40
+ .arpw-form-tabs.ui-tabs-vertical .arpw-tabs-content {
41
+ background-color: #fff;
42
+ overflow: hidden;
43
+ margin-top: 1em;
44
+ margin-bottom: 1em;
45
+ min-height: 12em;
46
+ padding: 1em 1.5em 1em 1.5em;
47
+ }
48
+
49
+ .arpw-tab-content p {
50
+ margin-bottom: 1.5em;
51
+ }
52
+
53
+ .arpw-tab-content p small {
54
+ color: #777;
55
+ font-style: italic;
56
}
57
58
.arpw-multiple-check-form {
64
padding: 10px;
65
max-height: 110px;
66
overflow: auto;
67
}
68
69
.arpw-multiple-check-form ul li:last-child {
70
margin-bottom: 0;
71
+ }
72
+
73
+ label.input-checkbox {
74
+ width: 100px;
75
+ display: inline-block;
76
+ }
77
+
78
+ .arpw-input-half {
79
+ width: 47%;
80
+ }
81
+
82
+ .arpw-block {
83
+ display: block;
84
}
assets/css/arpw-frontend.css CHANGED
@@ -1,5 +1,6 @@
1
.arpw-ul {
2
list-style: none;
3
}
4
5
.arpw-li {
1
.arpw-ul {
2
list-style: none;
3
+ padding: 0;
4
}
5
6
.arpw-li {
assets/js/jquery-cookie.js ADDED
@@ -0,0 +1,114 @@
1
+ /*!
2
+ * jQuery Cookie Plugin v1.4.1
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2006, 2014 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD (Register as an anonymous module)
11
+ define(['jquery'], factory);
12
+ } else if (typeof exports === 'object') {
13
+ // Node/CommonJS
14
+ module.exports = factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+
21
+ var pluses = /\+/g;
22
+
23
+ function encode(s) {
24
+ return config.raw ? s : encodeURIComponent(s);
25
+ }
26
+
27
+ function decode(s) {
28
+ return config.raw ? s : decodeURIComponent(s);
29
+ }
30
+
31
+ function stringifyCookieValue(value) {
32
+ return encode(config.json ? JSON.stringify(value) : String(value));
33
+ }
34
+
35
+ function parseCookieValue(s) {
36
+ if (s.indexOf('"') === 0) {
37
+ // This is a quoted cookie as according to RFC2068, unescape...
38
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
39
+ }
40
+
41
+ try {
42
+ // Replace server-side written pluses with spaces.
43
+ // If we can't decode the cookie, ignore it, it's unusable.
44
+ // If we can't parse the cookie, ignore it, it's unusable.
45
+ s = decodeURIComponent(s.replace(pluses, ' '));
46
+ return config.json ? JSON.parse(s) : s;
47
+ } catch(e) {}
48
+ }
49
+
50
+ function read(s, converter) {
51
+ var value = config.raw ? s : parseCookieValue(s);
52
+ return $.isFunction(converter) ? converter(value) : value;
53
+ }
54
+
55
+ var config = $.cookie = function (key, value, options) {
56
+
57
+ // Write
58
+
59
+ if (arguments.length > 1 && !$.isFunction(value)) {
60
+ options = $.extend({}, config.defaults, options);
61
+
62
+ if (typeof options.expires === 'number') {
63
+ var days = options.expires, t = options.expires = new Date();
64
+ t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
65
+ }
66
+
67
+ return (document.cookie = [
68
+ encode(key), '=', stringifyCookieValue(value),
69
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
70
+ options.path ? '; path=' + options.path : '',
71
+ options.domain ? '; domain=' + options.domain : '',
72
+ options.secure ? '; secure' : ''
73
+ ].join(''));
74
+ }
75
+
76
+ // Read
77
+
78
+ var result = key ? undefined : {},
79
+ // To prevent the for loop in the first place assign an empty array
80
+ // in case there are no cookies at all. Also prevents odd result when
81
+ // calling $.cookie().
82
+ cookies = document.cookie ? document.cookie.split('; ') : [],
83
+ i = 0,
84
+ l = cookies.length;
85
+
86
+ for (; i < l; i++) {
87
+ var parts = cookies[i].split('='),
88
+ name = decode(parts.shift()),
89
+ cookie = parts.join('=');
90
+
91
+ if (key === name) {
92
+ // If second argument (value) is a function it's a converter...
93
+ result = read(cookie, value);
94
+ break;
95
+ }
96
+
97
+ // Prevent storing a cookie that we couldn't decode.
98
+ if (!key && (cookie = read(cookie)) !== undefined) {
99
+ result[name] = cookie;
100
+ }
101
+ }
102
+
103
+ return result;
104
+ };
105
+
106
+ config.defaults = {};
107
+
108
+ $.removeCookie = function (key, options) {
109
+ // Must not alter options, thus extending a fresh object...
110
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
111
+ return !$.cookie(key);
112
+ };
113
+
114
+ }));
includes/form.php CHANGED
@@ -1,239 +1,285 @@
1
<?php
2
/**
3
* Widget forms.
4
- *
5
- * @package Advanced_Random_Posts_Widget
6
- * @since 0.0.1
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
*/
11
?>
12
13
- <div class="arpw-columns-3">
14
-
15
- <p>
16
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">
17
- <?php _e( 'Title', 'arpw' ); ?>
18
- </label>
19
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
20
- </p>
21
-
22
- <p>
23
- <label for="<?php echo $this->get_field_id( 'title_url' ); ?>">
24
- <?php _e( 'Title URL', 'arpw' ); ?>
25
- </label>
26
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title_url' ); ?>" name="<?php echo $this->get_field_name( 'title_url' ); ?>" value="<?php echo esc_url( $instance['title_url'] ); ?>" placeholder="<?php echo esc_attr( 'http://' ); ?>" />
27
- </p>
28
-
29
- <p>
30
- <label for="<?php echo $this->get_field_id( 'css_class' ); ?>">
31
- <?php _e( 'CSS Class', 'arpw' ); ?>
32
- </label>
33
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'css_class' ); ?>" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo sanitize_html_class( $instance['css_class'] ); ?>" />
34
- </p>
35
-
36
- <p>
37
- <label for="<?php echo $this->get_field_id( 'before' ); ?>">
38
- <?php _e( 'HTML or text before the random posts', 'arpw' );?>
39
- </label>
40
- <textarea class="widefat" id="<?php echo $this->get_field_id( 'before' ); ?>" name="<?php echo $this->get_field_name( 'before' ); ?>" rows="5"><?php echo htmlspecialchars( stripslashes( $instance['before'] ) ); ?></textarea>
41
- </p>
42
-
43
- <p>
44
- <label for="<?php echo $this->get_field_id( 'after' ); ?>">
45
- <?php _e( 'HTML or text after the random posts', 'arpw' );?>
46
- </label>
47
- <textarea class="widefat" id="<?php echo $this->get_field_id( 'after' ); ?>" name="<?php echo $this->get_field_name( 'after' ); ?>" rows="5"><?php echo htmlspecialchars( stripslashes( $instance['after'] ) ); ?></textarea>
48
- </p>
49
-
50
- </div>
51
-
52
- <div class="arpw-columns-3">
53
-
54
- <p>
55
- <input class="checkbox" type="checkbox" <?php checked( $instance['ignore_sticky'], 1 ); ?> id="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>" name="<?php echo $this->get_field_name( 'ignore_sticky' ); ?>" />
56
- <label for="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>">
57
- <?php _e( 'Ignore sticky posts', 'arpw' ); ?>
58
- </label>
59
- </p>
60
-
61
- <p>
62
- <label for="<?php echo $this->get_field_id( 'limit' ); ?>">
63
- <?php _e( 'Number of posts to show', 'arpw' ); ?>
64
- </label>
65
- <input class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" step="1" min="-1" value="<?php echo (int) $instance['limit']; ?>" />
66
- <small>-1 <?php _e( 'to show all posts.', 'arpw' ); ?></small>
67
- </p>
68
-
69
- <p>
70
- <label for="<?php echo $this->get_field_id( 'offset' ); ?>">
71
- <?php _e( 'Offset', 'arpw' ); ?>
72
- </label>
73
- <input type="number" step="1" min="0" class="widefat" id="<?php echo $this->get_field_id( 'offset' ); ?>" name="<?php echo $this->get_field_name( 'offset' ); ?>" value="<?php echo (int) $instance['offset']; ?>" />
74
- <small><?php _e( 'The number of posts to skip', 'arpw' ); ?></small>
75
- </p>
76
-
77
- <p>
78
- <label for="<?php echo $this->get_field_id( 'post_type' ); ?>">
79
- <?php _e( 'Post type', 'arpw' ); ?>
80
- </label>
81
- <select class="widefat" id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>">
82
- <?php foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $post_type ) { ?>
83
- <option value="<?php echo esc_attr( $post_type->name ); ?>" <?php selected( $instance['post_type'], $post_type->name ); ?>><?php echo esc_html( $post_type->labels->singular_name ); ?></option>
84
- <?php } ?>
85
- </select>
86
- </p>
87
-
88
- <p>
89
- <label for="<?php echo $this->get_field_id( 'post_status' ); ?>">
90
- <?php _e( 'Post status', 'arpw' ); ?>
91
- </label>
92
- <select class="widefat" id="<?php echo $this->get_field_id( 'post_status' ); ?>" name="<?php echo $this->get_field_name( 'post_status' ); ?>" style="width:100%;">
93
- <?php foreach ( get_available_post_statuses() as $status_value => $status_label ) { ?>
94
- <option value="<?php echo esc_attr( $status_label ); ?>" <?php selected( $instance['post_status'], $status_label ); ?>><?php echo esc_html( ucfirst( $status_label ) ); ?></option>
95
- <?php } ?>
96
- </select>
97
- </p>
98
-
99
- <div class="arpw-multiple-check-form">
100
- <label>
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; ?>">
108
- <?php echo esc_html( $category->name ); ?>
109
</label>
110
- </li>
111
- <?php endforeach; ?>
112
- </ul>
113
- </div>
114
-
115
- <div class="arpw-multiple-check-form">
116
- <label>
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; ?>">
124
- <?php echo esc_html( $post_tag->name ); ?>
125
</label>
126
- </li>
127
- <?php endforeach; ?>
128
- </ul>
129
- </div>
130
-
131
- <p>
132
- <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
133
- <?php _e( 'Limit to Taxonomy', 'arpw' ); ?>
134
- </label>
135
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="<?php echo esc_attr( $instance['taxonomy'] ); ?>" />
136
- <small><?php _e( 'Ex: category=1,2,4&amp;post_tag=6,12', 'arpw' );?><br />
137
- <?php _e( 'Available: ', 'arpw' ); echo implode( ', ', get_taxonomies( array( 'public' => true ) ) ); ?></small>
138
- </p>
139
-
140
- </div>
141
-
142
- <div class="arpw-columns-3 arpw-column-last">
143
-
144
- <?php // Check if the theme support Post Thumbnail feature. ?>
145
- <?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?>
146
-
147
- <p>
148
- <input class="checkbox" type="checkbox" <?php checked( $instance['thumbnail'] ); ?> id="<?php echo $this->get_field_id( 'thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail' ); ?>" />
149
- <label for="<?php echo $this->get_field_id( 'thumbnail' ); ?>">
150
- <?php _e( 'Display thumbnail', 'arpw' ); ?>
151
- </label>
152
- </p>
153
-
154
- <p>
155
- <label for="<?php echo $this->get_field_id( 'thumbnail_size' ); ?>">
156
- <?php _e( 'Thumbnail Size ', 'arpw' ); ?>
157
- </label>
158
- <select class="widefat" id="<?php echo $this->get_field_id( 'thumbnail_size' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" style="width:100%;">
159
- <?php foreach ( get_intermediate_image_sizes() as $size ) { ?>
160
- <option value="<?php echo esc_attr( $size ); ?>" <?php selected( $instance['thumbnail_size'], $size ); ?>><?php echo esc_html( $size ); ?></option>
161
- <?php } ?>
162
- </select>
163
- <small><?php printf( __( 'Please read %1$sFAQ%2$s for more information.', 'arpw' ), '<a href="http://wordpress.org/plugins/advanced-random-posts-widget/faq/" target="_blank">', '</a>' ); ?></small>
164
- </p>
165
-
166
- <p>
167
- <input class="checkbox" type="checkbox" <?php checked( $instance['thumbnail_custom'] ); ?> id="<?php echo $this->get_field_id( 'thumbnail_custom' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_custom' ); ?>" />
168
- <label for="<?php echo $this->get_field_id( 'thumbnail_custom' ); ?>">
169
- <?php _e( 'Use custom thumbnail sizes', 'arpw' ); ?>
170
- </label>
171
- </p>
172
-
173
- <p>
174
- <label class="arpw-block" for="<?php echo $this->get_field_id( 'thumbnail_width' ); ?>">
175
- <?php _e( 'Width & Height', 'arpw' ); ?>
176
- </label>
177
- <input class="arpw-input-half" id="<?php echo $this->get_field_id( 'thumbnail_width' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_width' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['thumbnail_width'] ); ?>" />
178
- <input class="arpw-input-half" id="<?php echo $this->get_field_id( 'thumbnail_height' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_height' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['thumbnail_height'] ); ?>" />
179
- </p>
180
-
181
- <p>
182
- <label for="<?php echo $this->get_field_id( 'thumbnail_align' ); ?>">
183
- <?php _e( 'Thumbnail Alignment', 'arpw' ); ?>
184
- </label>
185
- <select class="widefat" id="<?php echo $this->get_field_id( 'thumbnail_align' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_align' ); ?>" style="width:100%;">
186
- <option value="left" <?php selected( $instance['thumbnail_align'], 'left' ); ?>><?php _e( 'Left', 'arpw' ) ?></option>
187
- <option value="right" <?php selected( $instance['thumbnail_align'], 'right' ); ?>><?php _e( 'Right', 'arpw' ) ?></option>
188
- <option value="center" <?php selected( $instance['thumbnail_align'], 'center' ); ?>><?php _e( 'Center', 'arpw' ) ?></option>
189
- </select>
190
- </p>
191
-
192
- <?php endif; ?>
193
-
194
- <p>
195
- <input class="checkbox" type="checkbox" <?php checked( $instance['excerpt'] ); ?> id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" />
196
- <label for="<?php echo $this->get_field_id( 'excerpt' ); ?>">
197
- <?php _e( 'Display excerpt', 'arpw' ); ?>
198
- </label>
199
- </p>
200
-
201
- <p>
202
- <label for="<?php echo $this->get_field_id( 'excerpt_length' ); ?>">
203
- <?php _e( 'Excerpt Length', 'arpw' ); ?>
204
- </label>
205
- <input class="widefat" id="<?php echo $this->get_field_id( 'excerpt_length' ); ?>" name="<?php echo $this->get_field_name( 'excerpt_length' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['excerpt_length'] ); ?>" />
206
- </p>
207
-
208
- <p>
209
- <input class="checkbox" type="checkbox" <?php checked( $instance['date'] ); ?> id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" />
210
- <label for="<?php echo $this->get_field_id( 'date' ); ?>">
211
- <?php _e( 'Display Date', 'arpw' ); ?>
212
- </label>
213
- </p>
214
-
215
- <p>
216
- <input id="<?php echo $this->get_field_id( 'date_modified' ); ?>" name="<?php echo $this->get_field_name( 'date_modified' ); ?>" type="checkbox" <?php checked( $instance['date_modified'] ); ?> />
217
- <label for="<?php echo $this->get_field_id( 'date_modified' ); ?>">
218
- <?php _e( 'Display Modified Date', 'arpw' ); ?>
219
- </label>
220
- </p>
221
-
222
- <p>
223
- <input id="<?php echo $this->get_field_id( 'date_relative' ); ?>" name="<?php echo $this->get_field_name( 'date_relative' ); ?>" type="checkbox" <?php checked( $instance['date_relative'] ); ?> />
224
- <label for="<?php echo $this->get_field_id( 'date_relative' ); ?>">
225
- <?php _e( 'Use Relative Date. eg: 5 days ago', 'arpw' ); ?>
226
- </label>
227
- </p>
228
-
229
- </div>
230
-
231
- <div class="clear"></div>
232
-
233
- <p>
234
- <label for="<?php echo $this->get_field_id( 'css' ); ?>">
235
- <?php _e( 'Custom CSS', 'arpw' ); ?>
236
- </label>
237
- <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>
238
- <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>
239
- </p>
1
<?php
2
/**
3
* Widget forms.
4
*/
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
?>
9
10
+ <script>
11
+ jQuery( function( $ ) {
12
+
13
+ // Cache selector in a variable
14
+ var $form = $( ".arpw-form-tabs" );
15
+
16
+ $form.tabs({
17
+ active : $.cookie( "activetab" ),
18
+ activate : function( event, ui ) {
19
+ $.cookie( "activetab", ui.newTab.index(), {
20
+ expires : 10
21
+ });
22
+ }
23
+ }).addClass( "ui-tabs-vertical" );
24
+
25
+ // Add custom class
26
+ $form.closest( ".widget-inside" ).addClass( "arpw-bg" );
27
+
28
+ });
29
+ </script>
30
+
31
+ <div class="arpw-form-tabs">
32
+
33
+ <ul class="arpw-tabs">
34
+ <li><a href="#tab-1"><?php _ex( 'General', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
35
+ <li><a href="#tab-2"><?php _ex( 'Posts', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
36
+ <li><a href="#tab-3"><?php _ex( 'Taxonomy', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
37
+ <li><a href="#tab-4"><?php _ex( 'Thumbnail', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
38
+ <li><a href="#tab-5"><?php _ex( 'Extras', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
39
+ <li><a href="#tab-6"><?php _ex( 'Custom CSS', 'widget tab name', 'advanced-random-posts-widget' ); ?></a></li>
40
+ </ul>
41
+
42
+ <div class="arpw-tabs-content">
43
+
44
+ <div id="tab-1" class="arpw-tab-content">
45
+
46
+ <p>
47
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>">
48
+ <?php _e( 'Title', 'advanced-random-posts-widget' ); ?>
49
+ </label>
50
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
51
+ </p>
52
+
53
+ <p>
54
+ <label for="<?php echo $this->get_field_id( 'title_url' ); ?>">
55
+ <?php _e( 'Title URL', 'advanced-random-posts-widget' ); ?>
56
+ </label>
57
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title_url' ); ?>" name="<?php echo $this->get_field_name( 'title_url' ); ?>" value="<?php echo esc_url( $instance['title_url'] ); ?>" placeholder="<?php echo esc_attr( 'http://' ); ?>" />
58
+ </p>
59
+
60
+ <p>
61
+ <label for="<?php echo $this->get_field_id( 'css_class' ); ?>">
62
+ <?php _e( 'CSS Class', 'advanced-random-posts-widget' ); ?>
63
+ </label>
64
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'css_class' ); ?>" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo sanitize_html_class( $instance['css_class'] ); ?>" />
65
+ </p>
66
+
67
+ <p>
68
+ <label for="<?php echo $this->get_field_id( 'before' ); ?>">
69
+ <?php _e( 'HTML or text before the random posts', 'advanced-random-posts-widget' );?>
70
+ </label>
71
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'before' ); ?>" name="<?php echo $this->get_field_name( 'before' ); ?>" rows="5"><?php echo htmlspecialchars( stripslashes( $instance['before'] ) ); ?></textarea>
72
+ </p>
73
+
74
+ <p>
75
+ <label for="<?php echo $this->get_field_id( 'after' ); ?>">
76
+ <?php _e( 'HTML or text after the random posts', 'advanced-random-posts-widget' );?>
77
+ </label>
78
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'after' ); ?>" name="<?php echo $this->get_field_name( 'after' ); ?>" rows="5"><?php echo htmlspecialchars( stripslashes( $instance['after'] ) ); ?></textarea>
79
+ </p>
80
+
81
+ </div><!-- #tab-1 -->
82
+
83
+ <div id="tab-2" class="arpw-tab-content">
84
+
85
+ <p>
86
+ <input class="checkbox" type="checkbox" <?php checked( $instance['ignore_sticky'], 1 ); ?> id="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>" name="<?php echo $this->get_field_name( 'ignore_sticky' ); ?>" />
87
+ <label for="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>">
88
+ <?php _e( 'Ignore sticky posts', 'advanced-random-posts-widget' ); ?>
89
+ </label>
90
+ </p>
91
+
92
+ <p>
93
+ <label for="<?php echo $this->get_field_id( 'limit' ); ?>">
94
+ <?php _e( 'Number of posts to show', 'advanced-random-posts-widget' ); ?>
95
+ </label>
96
+ <input class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" step="1" min="-1" value="<?php echo (int) $instance['limit']; ?>" />
97
+ <small>-1 <?php _e( 'to show all posts.', 'advanced-random-posts-widget' ); ?></small>
98
+ </p>
99
+
100
+ <p>
101
+ <label for="<?php echo $this->get_field_id( 'offset' ); ?>">
102
+ <?php _e( 'Offset', 'advanced-random-posts-widget' ); ?>
103
+ </label>
104
+ <input type="number" step="1" min="0" class="widefat" id="<?php echo $this->get_field_id( 'offset' ); ?>" name="<?php echo $this->get_field_name( 'offset' ); ?>" value="<?php echo (int) $instance['offset']; ?>" />
105
+ <small><?php _e( 'The number of posts to skip', 'advanced-random-posts-widget' ); ?></small>
106
+ </p>
107
+
108
+ <p>
109
+ <label for="<?php echo $this->get_field_id( 'post_type' ); ?>">
110
+ <?php _e( 'Post type', 'advanced-random-posts-widget' ); ?>
111
+ </label>
112
+ <select class="widefat" id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>">
113
+ <?php foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $post_type ) { ?>
114
+ <option value="<?php echo esc_attr( $post_type->name ); ?>" <?php selected( $instance['post_type'], $post_type->name ); ?>><?php echo esc_html( $post_type->labels->singular_name ); ?></option>
115
+ <?php } ?>
116
+ </select>
117
+ </p>
118
+
119
+ <p>
120
+ <label for="<?php echo $this->get_field_id( 'post_status' ); ?>">
121
+ <?php _e( 'Post status', 'advanced-random-posts-widget' ); ?>
122
+ </label>
123
+ <select class="widefat" id="<?php echo $this->get_field_id( 'post_status' ); ?>" name="<?php echo $this->get_field_name( 'post_status' ); ?>" style="width:100%;">
124
+ <?php foreach ( get_available_post_statuses() as $status_value => $status_label ) { ?>
125
+ <option value="<?php echo esc_attr( $status_label ); ?>" <?php selected( $instance['post_status'], $status_label ); ?>><?php echo esc_html( ucfirst( $status_label ) ); ?></option>
126
+ <?php } ?>
127
+ </select>
128
+ </p>
129
+
130
+ </div><!-- #tab-2 -->
131
+
132
+ <div id="tab-3" class="arpw-tab-content">
133
+
134
+ <div class="arpw-multiple-check-form">
135
+ <label>
136
+ <?php _e( 'Limit to Category', 'advanced-random-posts-widget' ); ?>
137
+ </label>
138
+ <ul>
139
+ <?php foreach ( arpw_term_list( 'category' ) as $category ) : ?>
140
+ <li>
141
+ <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'] ) ); ?> />
142
+ <label for="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>">
143
+ <?php echo esc_html( $category->name ); ?>
144
+ </label>
145
+ </li>
146
+ <?php endforeach; ?>
147
+ </ul>
148
+ </div>
149
+
150
+ <div class="arpw-multiple-check-form">
151
+ <label>
152
+ <?php _e( 'Limit to Tag', 'advanced-random-posts-widget' ); ?>
153
+ </label>
154
+ <ul>
155
+ <?php foreach ( arpw_term_list( 'post_tag' ) as $post_tag ) : ?>
156
+ <li>
157
+ <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'] ) ); ?> />
158
+ <label for="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>">
159
+ <?php echo esc_html( $post_tag->name ); ?>
160
+ </label>
161
+ </li>
162
+ <?php endforeach; ?>
163
+ </ul>
164
+ </div>
165
+
166
+ <p>
167
+ <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
168
+ <?php _e( 'Limit to Taxonomy', 'advanced-random-posts-widget' ); ?>
169
+ </label>
170
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="<?php echo esc_attr( $instance['taxonomy'] ); ?>" />
171
+ <small><?php _e( 'Ex: category=1,2,4&amp;post_tag=6,12', 'advanced-random-posts-widget' );?><br />
172
+ <?php _e( 'Available: ', 'advanced-random-posts-widget' ); echo implode( ', ', get_taxonomies( array( 'public' => true ) ) ); ?></small>
173
+ </p>
174
+
175
+ </div><!-- #tab-3 -->
176
+
177
+ <div id="tab-4" class="arpw-tab-content">
178
+
179
+ <?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?>
180
+
181
+ <p>
182
+ <input class="checkbox" type="checkbox" <?php checked( $instance['thumbnail'] ); ?> id="<?php echo $this->get_field_id( 'thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail' ); ?>" />
183
+ <label for="<?php echo $this->get_field_id( 'thumbnail' ); ?>">
184
+ <?php _e( 'Display thumbnail', 'advanced-random-posts-widget' ); ?>
185
</label>
186
+ </p>
187
+
188
+ <p>
189
+ <label for="<?php echo $this->get_field_id( 'thumbnail_size' ); ?>">
190
+ <?php _e( 'Thumbnail Size ', 'advanced-random-posts-widget' ); ?>
191
+ </label>
192
+ <select class="widefat" id="<?php echo $this->get_field_id( 'thumbnail_size' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" style="width:100%;">
193
+ <?php foreach ( get_intermediate_image_sizes() as $size ) { ?>
194
+ <option value="<?php echo esc_attr( $size ); ?>" <?php selected( $instance['thumbnail_size'], $size ); ?>><?php echo esc_html( $size ); ?></option>
195
+ <?php } ?>
196
+ </select>
197
+ <small><?php printf( __( 'Please read %1$sFAQ%2$s for more information.', 'advanced-random-posts-widget' ), '<a href="http://wordpress.org/plugins/advanced-random-posts-widget/faq/" target="_blank">', '</a>' ); ?></small>
198
+ </p>
199
+
200
+ <p>
201
+ <input class="checkbox" type="checkbox" <?php checked( $instance['thumbnail_custom'] ); ?> id="<?php echo $this->get_field_id( 'thumbnail_custom' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_custom' ); ?>" />
202
+ <label for="<?php echo $this->get_field_id( 'thumbnail_custom' ); ?>">
203
+ <?php _e( 'Use custom thumbnail sizes', 'advanced-random-posts-widget' ); ?>
204
</label>
205
+ </p>
206
+
207
+ <p>
208
+ <label class="arpw-block" for="<?php echo $this->get_field_id( 'thumbnail_width' ); ?>">
209
+ <?php _e( 'Width & Height', 'advanced-random-posts-widget' ); ?>
210
+ </label>
211
+ <input class="arpw-input-half" id="<?php echo $this->get_field_id( 'thumbnail_width' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_width' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['thumbnail_width'] ); ?>" />
212
+ <input class="arpw-input-half" id="<?php echo $this->get_field_id( 'thumbnail_height' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_height' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['thumbnail_height'] ); ?>" />
213
+ </p>
214
+
215
+ <p>
216
+ <label for="<?php echo $this->get_field_id( 'thumbnail_align' ); ?>">
217
+ <?php _e( 'Thumbnail Alignment', 'advanced-random-posts-widget' ); ?>
218
+ </label>
219
+ <select class="widefat" id="<?php echo $this->get_field_id( 'thumbnail_align' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail_align' ); ?>" style="width:100%;">
220
+ <option value="left" <?php selected( $instance['thumbnail_align'], 'left' ); ?>><?php _e( 'Left', 'advanced-random-posts-widget' ) ?></option>
221
+ <option value="right" <?php selected( $instance['thumbnail_align'], 'right' ); ?>><?php _e( 'Right', 'advanced-random-posts-widget' ) ?></option>
222
+ <option value="center" <?php selected( $instance['thumbnail_align'], 'center' ); ?>><?php _e( 'Center', 'advanced-random-posts-widget' ) ?></option>
223
+ </select>
224
+ </p>
225
+
226
+ <?php else : ?>
227
+ <p><?php printf( __( 'Your theme does not support Post Thumbnail feature, please go to %1$shttp://codex.wordpress.org/Post_Thumbnails%2$s to read more info and how to activate it in your theme.', 'advanced-random-posts-widget' ), '<a href="http://codex.wordpress.org/Post_Thumbnails" target="_blank">', '</a>' ); ?></p>
228
+ <?php endif; ?>
229
+
230
+ </div><!-- #tab-4 -->
231
+
232
+ <div id="tab-5" class="arpw-tab-content">
233
+
234
+ <p>
235
+ <input class="checkbox" type="checkbox" <?php checked( $instance['excerpt'] ); ?> id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" />
236
+ <label for="<?php echo $this->get_field_id( 'excerpt' ); ?>">
237
+ <?php _e( 'Display excerpt', 'advanced-random-posts-widget' ); ?>
238
+ </label>
239
+ </p>
240
+
241
+ <p>
242
+ <label for="<?php echo $this->get_field_id( 'excerpt_length' ); ?>">
243
+ <?php _e( 'Excerpt Length', 'advanced-random-posts-widget' ); ?>
244
+ </label>
245
+ <input class="widefat" id="<?php echo $this->get_field_id( 'excerpt_length' ); ?>" name="<?php echo $this->get_field_name( 'excerpt_length' ); ?>" type="number" step="1" min="0" value="<?php echo (int)( $instance['excerpt_length'] ); ?>" />
246
+ </p>
247
+
248
+ <p>
249
+ <input class="checkbox" type="checkbox" <?php checked( $instance['date'] ); ?> id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" />
250
+ <label for="<?php echo $this->get_field_id( 'date' ); ?>">
251
+ <?php _e( 'Display Date', 'advanced-random-posts-widget' ); ?>
252
+ </label>
253
+ </p>
254
+
255
+ <p>
256
+ <input id="<?php echo $this->get_field_id( 'date_modified' ); ?>" name="<?php echo $this->get_field_name( 'date_modified' ); ?>" type="checkbox" <?php checked( $instance['date_modified'] ); ?> />
257
+ <label for="<?php echo $this->get_field_id( 'date_modified' ); ?>">
258
+ <?php _e( 'Display Modified Date', 'advanced-random-posts-widget' ); ?>
259
+ </label>
260
+ </p>
261
+
262
+ <p>
263
+ <input id="<?php echo $this->get_field_id( 'date_relative' ); ?>" name="<?php echo $this->get_field_name( 'date_relative' ); ?>" type="checkbox" <?php checked( $instance['date_relative'] ); ?> />
264
+ <label for="<?php echo $this->get_field_id( 'date_relative' ); ?>">
265
+ <?php _e( 'Use Relative Date. eg: 5 days ago', 'advanced-random-posts-widget' ); ?>
266
+ </label>
267
+ </p>
268
+
269
+ </div><!-- #tab-5 -->
270
+
271
+ <div id="tab-6" class="arpw-tab-content">
272
+
273
+ <p>
274
+ <label for="<?php echo $this->get_field_id( 'css' ); ?>">
275
+ <?php _e( 'Custom CSS', 'advanced-random-posts-widget' ); ?>
276
+ </label>
277
+ <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>
278
+ <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>
279
+ </p>
280
+
281
+ </div><!-- #tab-6 -->
282
+
283
+ </div><!-- .arpw-tabs-content -->
284
+
285
+ </div>
includes/functions.php CHANGED
@@ -1,23 +1,17 @@
1
<?php
2
/**
3
* Various functions used by the plugin.
4
- *
5
- * @package Advanced_Random_Posts_Widget
6
- * @since 0.0.1
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
*/
11
12
/**
13
* Sets up the default arguments.
14
- *
15
* @since 0.0.1
16
*/
17
function arpw_get_default_args() {
18
19
$defaults = array(
20
- 'title' => esc_attr__( 'Random Posts', 'arpw' ),
21
'title_url' => '',
22
23
'offset' => 0,
@@ -55,197 +49,26 @@ function arpw_get_default_args() {
55
}
56
57
/**
58
- * Outputs the random posts.
59
- *
60
- * @since 0.0.1
61
- */
62
- function arpw_random_posts( $args = array() ) {
63
- echo arpw_get_random_posts( $args );
64
- }
65
-
66
- /**
67
- * Generates the random posts markup.
68
*
69
- * @since 0.0.1
70
- * @param array $args
71
- * @return string|array The HTML for the random posts.
72
*/
73
- function arpw_get_random_posts( $args = array() ) {
74
-
75
- // Set up a default, empty $html variable.
76
- $html = '';
77
-
78
- // Get the default arguments.
79
- $defaults = arpw_get_default_args();
80
-
81
- // Merge the input arguments and the defaults.
82
- $args = wp_parse_args( $args, $defaults );
83
-
84
- // Extract the array to allow easy use of variables.
85
- extract( $args );
86
-
87
- // Allow devs to hook in stuff before the loop.
88
- do_action( 'arpw_before_loop', $args );
89
-
90
- // Get the posts query.
91
- $posts = arpw_get_posts( $args );
92
-
93
- if ( $posts->have_posts() ) :
94
-
95
- $html = '<div class="arpw-random-' . sanitize_html_class( $args['post_type'] ) . ' ' . sanitize_html_class( $args['css_class'] ) . '">';
96
-
97
- $html .= '<ul class="arpw-ul">';
98
-
99
- while ( $posts->have_posts() ) : $posts->the_post();
100
-
101
- $html .= '<li class="arpw-li arpw-clearfix">';
102
-
103
- if ( $args['thumbnail'] ) :
104
-
105
- // Check if post has post thumbnail.
106
- if ( has_post_thumbnail() ) :
107
-
108
- // Custom thumbnail sizes.
109
- $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
110
- $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.
111
- $image = arpw_resize( $img_url, $args['thumbnail_width'], $args['thumbnail_height'], true );
112
-
113
- $html .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
114
- if ( $args['thumbnail_custom'] ) :
115
- $html .= '<img class="arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ) . '" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '">';
116
- else :
117
- $html .= get_the_post_thumbnail( get_the_ID(), $args['thumbnail_size'], array( 'alt' => esc_attr( get_the_title() ), 'class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ) ) );
118
- endif;
119
- $html .= '</a>';
120
-
121
- // If no post thumbnail found, check if Get The Image plugin exist and display the image.
122
- elseif ( function_exists( 'get_the_image' ) ) :
123
- if ( $args['thumbnail_custom'] ) :
124
- $html .= get_the_image( array(
125
- 'width' => (int) $args['thumbnail_width'],
126
- 'height' => (int) $args['thumbnail_height'],
127
- 'image_class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ),
128
- 'image_scan' => true,
129
- 'echo' => false,
130
- 'link_to_post' => true,
131
- ) );
132
- else:
133
- $html .= get_the_image( array(
134
- 'size' => $args['thumbnail_size'],
135
- 'image_class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ),
136
- 'image_scan' => true,
137
- 'echo' => false,
138
- 'link_to_post' => true,
139
- ) );
140
- endif;
141
-
142
- // Display nothing.
143
- else :
144
- $html .= null;
145
- endif;
146
-
147
- endif;
148
-
149
- $html .= '<a class="arpw-title" href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'arpw' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">' . esc_attr( get_the_title() ) . '</a>';
150
-
151
- if ( $args['date'] ) :
152
- $date = get_the_date();
153
- if ( $args['date_relative'] ) :
154
- $date = sprintf( __( '%s ago', 'arpw' ), human_time_diff( get_the_date( 'U' ), current_time( 'timestamp' ) ) );
155
- endif;
156
- $html .= '<time class="arpw-time published" datetime="' . esc_html( get_the_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
157
- elseif ( $args['date_modified'] ) : // if both date functions are provided, we use date to be backwards compatible
158
- $date = get_the_modified_date();
159
- if ( $args['date_relative'] ) :
160
- $date = sprintf( __( '%s ago', 'rpwe' ), human_time_diff( get_the_modified_date( 'U' ), current_time( 'timestamp' ) ) );
161
- endif;
162
- $html .= '<time class="arpw-time modfied" datetime="' . esc_html( get_the_modified_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
163
- endif;
164
165
- if ( $args['excerpt'] ) :
166
- $html .= '<div class="arpw-summary">' . wp_trim_words( apply_filters( 'arpw_excerpt', get_the_excerpt() ), $args['excerpt_length'], ' &hellip;' ) . '</div>';
167
- endif;
168
-
169
- $html .= '</li>';
170
-
171
- endwhile;
172
-
173
- $html .= '</ul>';
174
-
175
- $html .= '</div><!-- Generated by https://wordpress.org/plugins/advanced-random-posts-widget/ -->';
176
-
177
- endif;
178
-
179
- // Restore original Post Data.
180
- wp_reset_postdata();
181
-
182
- // Allow devs to hook in stuff after the loop.
183
- do_action( 'arpw_after_loop', $args );
184
-
185
- // Return the related posts markup.
186
- return $args['before'] . $html . $args['after'];
187
-
188
- }
189
-
190
- /**
191
- * The posts query.
192
- *
193
- * @since 0.0.1
194
- * @param array $args
195
- * @return array
196
- */
197
- function arpw_get_posts( $args = array() ) {
198
-
199
- // Query arguments.
200
- $query = array(
201
- 'offset' => $args['offset'],
202
- 'posts_per_page' => $args['limit'],
203
- 'orderby' => $args['orderby'],
204
- 'post_type' => $args['post_type'],
205
- 'post_status' => $args['post_status'],
206
- 'ignore_sticky_posts' => $args['ignore_sticky'],
207
);
208
209
- // Limit posts based on category.
210
- if ( ! empty( $args['cat'] ) ) {
211
- $query['category__in'] = $args['cat'];
212
- }
213
-
214
- // Limit posts based on post tag.
215
- if ( ! empty( $args['tag'] ) ) {
216
- $query['tag__in'] = $args['tag'];
217
- }
218
-
219
- /**
220
- * Taxonomy query.
221
- * Prop Miniloop plugin by Kailey Lampert.
222
- */
223
- if ( ! empty( $args['taxonomy'] ) ) {
224
225
- parse_str( $args['taxonomy'], $taxes );
226
- $tax_query = array();
227
- foreach( array_keys( $taxes ) as $k => $slug ) {
228
- $ids = explode( ',', $taxes[ $slug ] );
229
- $tax_query[] = array(
230
- 'taxonomy' => $slug,
231
- 'field' => 'id',
232
- 'terms' => $ids,
233
- 'operator' => 'IN'
234
- );
235
- }
236
-
237
- $query['tax_query'] = $tax_query;
238
-
239
- }
240
-
241
- // Allow plugins/themes developer to filter the default query.
242
- $query = apply_filters( 'arpw_query', $query );
243
-
244
- // Perform the query.
245
- $posts = new WP_Query( $query );
246
-
247
- return $posts;
248
249
}
250
251
/**
@@ -255,8 +78,13 @@ function arpw_get_posts( $args = array() ) {
255
*/
256
function arpw_custom_css( $args ) {
257
258
- if ( ! empty( $args['css'] ) ) {
259
- echo '<style>' . $args['css'] . '</style>';
260
}
261
262
}
1
<?php
2
/**
3
* Various functions used by the plugin.
4
*/
5
6
/**
7
* Sets up the default arguments.
8
+ *
9
* @since 0.0.1
10
*/
11
function arpw_get_default_args() {
12
13
$defaults = array(
14
+ 'title' => esc_attr__( 'Random Posts', 'advanced-random-posts-widget' ),
15
'title_url' => '',
16
17
'offset' => 0,
49
}
50
51
/**
52
+ * Display list of terms
53
*
54
+ * @since 1.0.0
55
+ * @param string $term The term name
56
+ * @return array Returns an array of term objects
57
*/
58
+ function arpw_term_list( $term ) {
59
60
+ // Arguments
61
+ $args = array(
62
+ 'number' => 99
63
);
64
65
+ // Allow dev to filter the arguments
66
+ $args = apply_filters( 'arpw_term_list_args', $args );
67
68
+ // Get the terms
69
+ $terms = get_terms( $term, $args );
70
71
+ return $terms;
72
}
73
74
/**
78
*/
79
function arpw_custom_css( $args ) {
80
81
+ // Sanitize Custom CSS
82
+ $css = $args['css'];
83
+ $css = wp_kses( $css, array( '\'', '\"', '>', '+' ) );
84
+ $css = str_replace( '&gt;', '>', $css );
85
+
86
+ if ( ! empty( $css ) ) {
87
+ echo '<style>' . $css . '</style>';
88
}
89
90
}
includes/helpers.php DELETED
@@ -1,52 +0,0 @@
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
- }
includes/posts.php ADDED
@@ -0,0 +1,198 @@
1
+ <?php
2
+ /**
3
+ * The random posts function
4
+ */
5
+
6
+ /**
7
+ * Outputs the random posts.
8
+ *
9
+ * @since 0.0.1
10
+ */
11
+ function arpw_random_posts( $args ) {
12
+ echo arpw_get_random_posts( $args );
13
+ }
14
+
15
+ /**
16
+ * Generates the random posts markup.
17
+ *
18
+ * @since 0.0.1
19
+ * @param array $args
20
+ * @return string|array The HTML for the random posts.
21
+ */
22
+ function arpw_get_random_posts( $args, $id ) {
23
+
24
+ // Set up a default, empty $html variable.
25
+ $html = '';
26
+
27
+ // Merge the input arguments and the defaults.
28
+ $args = wp_parse_args( $args, arpw_get_default_args() );
29
+
30
+ // Extract the array to allow easy use of variables.
31
+ extract( $args );
32
+
33
+ // Allow devs to hook in stuff before the loop.
34
+ do_action( 'arpw_before_loop', $args ); // Use this hook to add content to all query
35
+ do_action( 'arpw_before_loop_' . $id, $args ); // Use this hook to add content to spesific query
36
+
37
+ // Get the posts query.
38
+ $posts = arpw_get_posts( $args, $id );
39
+
40
+ if ( $posts->have_posts() ) :
41
+
42
+ $html = '<div class="arpw-random-' . sanitize_html_class( $args['post_type'] ) . ' ' . sanitize_html_class( $args['css_class'] ) . '">';
43
+
44
+ $html .= '<ul class="arpw-ul">';
45
+
46
+ while ( $posts->have_posts() ) : $posts->the_post();
47
+
48
+ $html .= '<li class="arpw-li arpw-clearfix">';
49
+
50
+ if ( $args['thumbnail'] ) :
51
+
52
+ // Check if post has post thumbnail.
53
+ if ( has_post_thumbnail() ) :
54
+
55
+ // Custom thumbnail sizes.
56
+ $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
57
+ $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.
58
+ $image = arpw_resize( $img_url, $args['thumbnail_width'], $args['thumbnail_height'], true );
59
+
60
+ $html .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
61
+ if ( $args['thumbnail_custom'] ) :
62
+ $html .= '<img class="arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ) . '" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '">';
63
+ else :
64
+ $html .= get_the_post_thumbnail( get_the_ID(), $args['thumbnail_size'], array( 'alt' => esc_attr( get_the_title() ), 'class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ) ) );
65
+ endif;
66
+ $html .= '</a>';
67
+
68
+ // If no post thumbnail found, check if Get The Image plugin exist and display the image.
69
+ elseif ( function_exists( 'get_the_image' ) ) :
70
+ if ( $args['thumbnail_custom'] ) :
71
+ $html .= get_the_image( array(
72
+ 'width' => (int) $args['thumbnail_width'],
73
+ 'height' => (int) $args['thumbnail_height'],
74
+ 'image_class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ),
75
+ 'image_scan' => true,
76
+ 'echo' => false,
77
+ 'link_to_post' => true,
78
+ ) );
79
+ else:
80
+ $html .= get_the_image( array(
81
+ 'size' => $args['thumbnail_size'],
82
+ 'image_class' => 'arpw-thumbnail align' . esc_attr( $args['thumbnail_align'] ),
83
+ 'image_scan' => true,
84
+ 'echo' => false,
85
+ 'link_to_post' => true,
86
+ ) );
87
+ endif;
88
+
89
+ // Display nothing.
90
+ else :
91
+ $html .= null;
92
+ endif;
93
+
94
+ endif;
95
+
96
+ $html .= '<a class="arpw-title" href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . esc_attr( get_the_title() ) . '</a>';
97
+
98
+ if ( $args['date'] ) :
99
+ $date = get_the_date();
100
+ if ( $args['date_relative'] ) :
101
+ $date = sprintf( __( '%s ago', 'advanced-random-posts-widget' ), human_time_diff( get_the_date( 'U' ), current_time( 'timestamp' ) ) );
102
+ endif;
103
+ $html .= '<time class="arpw-time published" datetime="' . esc_html( get_the_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
104
+ elseif ( $args['date_modified'] ) : // if both date functions are provided, we use date to be backwards compatible
105
+ $date = get_the_modified_date();
106
+ if ( $args['date_relative'] ) :
107
+ $date = sprintf( __( '%s ago', 'advanced-random-posts-widget' ), human_time_diff( get_the_modified_date( 'U' ), current_time( 'timestamp' ) ) );
108
+ endif;
109
+ $html .= '<time class="arpw-time modfied" datetime="' . esc_html( get_the_modified_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
110
+ endif;
111
+
112
+ if ( $args['excerpt'] ) :
113
+ $html .= '<div class="arpw-summary">' . wp_trim_words( apply_filters( 'arpw_excerpt', get_the_excerpt() ), $args['excerpt_length'], ' &hellip;' ) . '</div>';
114
+ endif;
115
+
116
+ $html .= '</li>';
117
+
118
+ endwhile;
119
+
120
+ $html .= '</ul>';
121
+
122
+ $html .= '</div><!-- Generated by https://wordpress.org/plugins/advanced-random-posts-widget/ -->';
123
+
124
+ endif;
125
+
126
+ // Restore original Post Data.
127
+ wp_reset_postdata();
128
+
129
+ // Allow devs to hook in stuff after the loop.
130
+ do_action( 'arpw_after_loop', $args ); // Use this hook to add content to all query
131
+ do_action( 'arpw_after_loop_' . $id, $args ); // Use this hook to add content to spesific query
132
+
133
+ // Return the related posts markup.
134
+ return wp_kses_post( $args['before'] ) . $html . wp_kses_post( $args['after'] );
135
+
136
+ }
137
+
138
+ /**
139
+ * The posts query.
140
+ *
141
+ * @since 0.0.1
142
+ * @param array $args
143
+ * @return array
144
+ */
145
+ function arpw_get_posts( $args, $id ) {
146
+
147
+ // Query arguments.
148
+ $query = array(
149
+ 'offset' => $args['offset'],
150
+ 'posts_per_page' => $args['limit'],
151
+ 'orderby' => $args['orderby'],
152
+ 'post_type' => $args['post_type'],
153
+ 'post_status' => $args['post_status'],
154
+ 'ignore_sticky_posts' => $args['ignore_sticky'],
155
+ );
156
+
157
+ // Limit posts based on category.
158
+ if ( ! empty( $args['cat'] ) ) {
159
+ $query['category__in'] = $args['cat'];
160
+ }
161
+
162
+ // Limit posts based on post tag.
163
+ if ( ! empty( $args['tag'] ) ) {
164
+ $query['tag__in'] = $args['tag'];
165
+ }
166
+
167
+ /**
168
+ * Taxonomy query.
169
+ * Prop Miniloop plugin by Kailey Lampert.
170
+ */
171
+ if ( ! empty( $args['taxonomy'] ) ) {
172
+
173
+ parse_str( $args['taxonomy'], $taxes );
174
+ $tax_query = array();
175
+ foreach( array_keys( $taxes ) as $k => $slug ) {
176
+ $ids = explode( ',', $taxes[ $slug ] );
177
+ $tax_query[] = array(
178
+ 'taxonomy' => $slug,
179
+ 'field' => 'id',
180
+ 'terms' => $ids,
181
+ 'operator' => 'IN'
182
+ );
183
+ }
184
+
185
+ $query['tax_query'] = $tax_query;
186
+
187
+ }
188
+
189
+ // Allow plugins/themes developer to filter the default query.
190
+ $query = apply_filters( 'arpw_query', $query ); // DEPRECATED
191
+ // $query = apply_filters( 'arpw_query_' . $id, $query ); // New filter, will introduce in version 2.5.0
192
+
193
+ // Perform the query.
194
+ $posts = new WP_Query( $query );
195
+
196
+ return $posts;
197
+
198
+ }
includes/shortcode.php CHANGED
@@ -1,12 +1,6 @@
1
<?php
2
/**
3
* Shortcode helper
4
- *
5
- * @package Advanced_Random_Posts_Widget
6
- * @since 0.0.1
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
*/
11
12
/**
@@ -14,8 +8,16 @@
14
*
15
* @since 0.0.1
16
*/
17
- function arpw_shortcode( $atts, $content ) {
18
$args = shortcode_atts( arpw_get_default_args(), $atts );
19
- return arpw_get_random_posts( $args );
20
}
21
add_shortcode( 'arpw', 'arpw_shortcode' );
1
<?php
2
/**
3
* Shortcode helper
4
*/
5
6
/**
8
*
9
* @since 0.0.1
10
*/
11
+ function arpw_shortcode( $atts ) {
12
+
13
+ // Get shortcode attr
14
$args = shortcode_atts( arpw_get_default_args(), $atts );
15
+
16
+ // Load default style
17
+ wp_enqueue_style( 'arpw-style' );
18
+
19
+ // Display the shortcode content
20
+ return arpw_get_random_posts( $args, get_the_ID() );
21
+
22
}
23
add_shortcode( 'arpw', 'arpw_shortcode' );
{classes → includes}/widget.php RENAMED
@@ -1,12 +1,6 @@
1
<?php
2
/**
3
* Custom random posts widget.
4
- *
5
- * @package Advanced_Random_Posts_Widget
6
- * @since 0.0.1
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
*/
11
class Advanced_Random_Posts_Widget extends WP_Widget {
12
@@ -20,22 +14,35 @@ class Advanced_Random_Posts_Widget extends WP_Widget {
20
// Set up the widget options.
21
$widget_options = array(
22
'classname' => 'arpw-widget-random',
23
- 'description' => __( 'An advanced widget that gives you total control over the output of the random posts.', 'arpw' )
24
);
25
26
$control_ops = array(
27
- 'width' => 700,
28
- 'height' => 350,
29
);
30
31
// Create the widget.
32
parent::__construct(
33
- 'arpw-widget', // $this->id_base
34
- __( 'Random Posts', 'arpw' ), // $this->name
35
- $widget_options, // $this->widget_options
36
- $control_ops // $this->control_options
37
);
38
39
}
40
41
/**
@@ -47,7 +54,7 @@ class Advanced_Random_Posts_Widget extends WP_Widget {
47
extract( $args );
48
49
// Get the random posts.
50
- $random = arpw_get_random_posts( $instance );
51
52
// Check if the random posts exist
53
if ( $random ) :
@@ -93,7 +100,7 @@ class Advanced_Random_Posts_Widget extends WP_Widget {
93
$instance['post_status'] = esc_attr( $new_instance['post_status'] );
94
$instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
95
$instance['cat'] = $new_instance['cat'];
96
- $instance['tag'] = $new_instance['tag'];
97
98
$instance['thumbnail'] = isset( $new_instance['thumbnail'] ) ? (bool) $new_instance['thumbnail'] : false;
99
$instance['thumbnail_size'] = esc_attr( $new_instance['thumbnail_size'] );
@@ -110,8 +117,8 @@ class Advanced_Random_Posts_Widget extends WP_Widget {
110
111
$instance['css'] = $new_instance['css'];
112
$instance['css_class'] = sanitize_html_class( $new_instance['css_class'] );
113
- $instance['before'] = stripslashes( $new_instance['before'] );
114
- $instance['after'] = stripslashes( $new_instance['after'] );
115
116
return $instance;
117
}
1
<?php
2
/**
3
* Custom random posts widget.
4
*/
5
class Advanced_Random_Posts_Widget extends WP_Widget {
6
14
// Set up the widget options.
15
$widget_options = array(
16
'classname' => 'arpw-widget-random',
17
+ 'description' => __( 'An advanced widget that gives you total control over the output of the random posts.', 'advanced-random-posts-widget' )
18
);
19
20
$control_ops = array(
21
+ 'width' => 450
22
);
23
24
// Create the widget.
25
parent::__construct(
26
+ 'arpw-widget', // $this->id_base
27
+ __( 'Random Posts', 'advanced-random-posts-widget' ), // $this->name
28
+ $widget_options, // $this->widget_options
29
+ $control_ops // $this->control_options
30
);
31
32
+ // Inline default style
33
+ if ( is_active_widget( false, false, $this->id_base ) ) {
34
+ add_action( 'wp_enqueue_scripts', array( $this, 'arpw_default_style' ) );
35
+ }
36
+
37
+ }
38
+
39
+ /**
40
+ * Default style
41
+ *
42
+ * @since 2.1.0
43
+ */
44
+ public function arpw_default_style() {
45
+ wp_enqueue_style( 'arpw-style' );
46
}
47
48
/**
54
extract( $args );
55
56
// Get the random posts.
57
+ $random = arpw_get_random_posts( $instance, $this->id );
58
59
// Check if the random posts exist
60
if ( $random ) :
100
$instance['post_status'] = esc_attr( $new_instance['post_status'] );
101
$instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
102
$instance['cat'] = $new_instance['cat'];
103
+ $instance['tag'] = $new_instance['tag'];
104
105
$instance['thumbnail'] = isset( $new_instance['thumbnail'] ) ? (bool) $new_instance['thumbnail'] : false;
106
$instance['thumbnail_size'] = esc_attr( $new_instance['thumbnail_size'] );
117
118
$instance['css'] = $new_instance['css'];
119
$instance['css_class'] = sanitize_html_class( $new_instance['css_class'] );
120
+ $instance['before'] = wp_kses_post( $new_instance['before'] );
121
+ $instance['after'] = wp_kses_post( $new_instance['after'] );
122
123
return $instance;
124
}
languages/{arpw.pot → advanced-random-posts-widget.pot} RENAMED
@@ -1,16 +1,16 @@
1
- # Copyright (C) 2015 Satrya
2
- # This file is distributed under the same license as the Random Posts Widget Extended package.
3
msgid ""
4
msgstr ""
5
- "Project-Id-Version: Random Posts Widget Extended 2.0.7\n"
6
"Report-Msgid-Bugs-To: http://satrya.me/\n"
7
- "POT-Creation-Date: 2015-08-14 06:54:18+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
11
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: Satrya (satrya@satrya.me)\n"
13
- "Language-Team: Satrya (satrya@satrya.me)\n"
14
"X-Generator: grunt-wp-i18n 0.5.3\n"
15
"Plural-Forms: nplurals=2; plural=n != 1;\n"
16
"X-Poedit-Basepath: ..\n"
@@ -23,172 +23,205 @@ msgstr ""
23
"x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
24
"X-Textdomain-Support: yes\n"
25
26
- #: classes/widget.php:23
27
- msgid ""
28
- "An advanced widget that gives you total control over the output of the "
29
- "random posts."
30
- msgstr ""
31
-
32
- #: classes/widget.php:34 includes/functions.php:20
33
- msgid "Random Posts"
34
- msgstr ""
35
-
36
- #: includes/form.php:17
37
msgid "Title"
38
msgstr ""
39
40
- #: includes/form.php:24
41
msgid "Title URL"
42
msgstr ""
43
44
- #: includes/form.php:31
45
msgid "CSS Class"
46
msgstr ""
47
48
- #: includes/form.php:38
49
msgid "HTML or text before the random posts"
50
msgstr ""
51
52
- #: includes/form.php:45
53
msgid "HTML or text after the random posts"
54
msgstr ""
55
56
- #: includes/form.php:57
57
msgid "Ignore sticky posts"
58
msgstr ""
59
60
- #: includes/form.php:63
61
msgid "Number of posts to show"
62
msgstr ""
63
64
- #: includes/form.php:66
65
msgid "to show all posts."
66
msgstr ""
67
68
- #: includes/form.php:71
69
msgid "Offset"
70
msgstr ""
71
72
- #: includes/form.php:74
73
msgid "The number of posts to skip"
74
msgstr ""
75
76
- #: includes/form.php:79
77
msgid "Post type"
78
msgstr ""
79
80
- #: includes/form.php:90
81
msgid "Post status"
82
msgstr ""
83
84
- #: includes/form.php:101
85
msgid "Limit to Category"
86
msgstr ""
87
88
- #: includes/form.php:117
89
msgid "Limit to Tag"
90
msgstr ""
91
92
- #: includes/form.php:133
93
msgid "Limit to Taxonomy"
94
msgstr ""
95
96
- #: includes/form.php:136
97
msgid "Ex: category=1,2,4&amp;post_tag=6,12"
98
msgstr ""
99
100
- #: includes/form.php:137
101
msgid "Available: "
102
msgstr ""
103
104
- #: includes/form.php:150
105
msgid "Display thumbnail"
106
msgstr ""
107
108
- #: includes/form.php:156
109
msgid "Thumbnail Size "
110
msgstr ""
111
112
- #: includes/form.php:163
113
msgid "Please read %1$sFAQ%2$s for more information."
114
msgstr ""
115
116
- #: includes/form.php:169
117
msgid "Use custom thumbnail sizes"
118
msgstr ""
119
120
- #: includes/form.php:175
121
msgid "Width & Height"
122
msgstr ""
123
124
- #: includes/form.php:183
125
msgid "Thumbnail Alignment"
126
msgstr ""
127
128
- #: includes/form.php:186
129
msgid "Left"
130
msgstr ""
131
132
- #: includes/form.php:187
133
msgid "Right"
134
msgstr ""
135
136
- #: includes/form.php:188
137
msgid "Center"
138
msgstr ""
139
140
- #: includes/form.php:197
141
msgid "Display excerpt"
142
msgstr ""
143
144
- #: includes/form.php:203
145
msgid "Excerpt Length"
146
msgstr ""
147
148
- #: includes/form.php:211
149
msgid "Display Date"
150
msgstr ""
151
152
- #: includes/form.php:218
153
msgid "Display Modified Date"
154
msgstr ""
155
156
- #: includes/form.php:225
157
msgid "Use Relative Date. eg: 5 days ago"
158
msgstr ""
159
160
- #: includes/form.php:235
161
msgid "Custom CSS"
162
msgstr ""
163
164
- #: includes/form.php:238
165
msgid "You can find the plugin css selector on %1$sFAQ page%2$s."
166
msgstr ""
167
168
- #: includes/functions.php:149
169
- msgid "Permalink to %s"
170
msgstr ""
171
172
- #: includes/functions.php:154 includes/functions.php:160
173
msgid "%s ago"
174
msgstr ""
175
176
#. Plugin Name of the plugin/theme
177
- msgid "Random Posts Widget Extended"
178
msgstr ""
179
180
#. Plugin URI of the plugin/theme
181
- msgid "http://satrya.me/projects/advanced-random-posts-widget/"
182
msgstr ""
183
184
#. Description of the plugin/theme
185
- msgid "Easy to display random posts via shortcode or widget."
186
msgstr ""
187
188
#. Author of the plugin/theme
189
- msgid "Satrya"
190
msgstr ""
191
192
#. Author URI of the plugin/theme
193
- msgid "http://satrya.me/"
194
msgstr ""
1
+ # Copyright (C) 2015 Theme Junkie
2
+ # This file is distributed under the same license as the Advanced Random Posts Widget package.
3
msgid ""
4
msgstr ""
5
+ "Project-Id-Version: Advanced Random Posts Widget 2.1.0\n"
6
"Report-Msgid-Bugs-To: http://satrya.me/\n"
7
+ "POT-Creation-Date: 2015-11-06 14:21:28+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
11
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: Theme Junkie (support@theme-junkie.com)\n"
13
+ "Language-Team: Theme Junkie (support@theme-junkie.com)\n"
14
"X-Generator: grunt-wp-i18n 0.5.3\n"
15
"Plural-Forms: nplurals=2; plural=n != 1;\n"
16
"X-Poedit-Basepath: ..\n"
23
"x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
24
"X-Textdomain-Support: yes\n"
25
26
+ #: includes/form.php:48
27
msgid "Title"
28
msgstr ""
29
30
+ #: includes/form.php:55
31
msgid "Title URL"
32
msgstr ""
33
34
+ #: includes/form.php:62
35
msgid "CSS Class"
36
msgstr ""
37
38
+ #: includes/form.php:69
39
msgid "HTML or text before the random posts"
40
msgstr ""
41
42
+ #: includes/form.php:76
43
msgid "HTML or text after the random posts"
44
msgstr ""
45
46
+ #: includes/form.php:88
47
msgid "Ignore sticky posts"
48
msgstr ""
49
50
+ #: includes/form.php:94
51
msgid "Number of posts to show"
52
msgstr ""
53
54
+ #: includes/form.php:97
55
msgid "to show all posts."
56
msgstr ""
57
58
+ #: includes/form.php:102
59
msgid "Offset"
60
msgstr ""
61
62
+ #: includes/form.php:105
63
msgid "The number of posts to skip"
64
msgstr ""
65
66
+ #: includes/form.php:110
67
msgid "Post type"
68
msgstr ""
69
70
+ #: includes/form.php:121
71
msgid "Post status"
72
msgstr ""
73
74
+ #: includes/form.php:136
75
msgid "Limit to Category"
76
msgstr ""
77
78
+ #: includes/form.php:152
79
msgid "Limit to Tag"
80
msgstr ""
81
82
+ #: includes/form.php:168
83
msgid "Limit to Taxonomy"
84
msgstr ""
85
86
+ #: includes/form.php:171
87
msgid "Ex: category=1,2,4&amp;post_tag=6,12"
88
msgstr ""
89
90
+ #: includes/form.php:172
91
msgid "Available: "
92
msgstr ""
93
94
+ #: includes/form.php:184
95
msgid "Display thumbnail"
96
msgstr ""
97
98
+ #: includes/form.php:190
99
msgid "Thumbnail Size "
100
msgstr ""
101
102
+ #: includes/form.php:197
103
msgid "Please read %1$sFAQ%2$s for more information."
104
msgstr ""
105
106
+ #: includes/form.php:203
107
msgid "Use custom thumbnail sizes"
108
msgstr ""
109
110
+ #: includes/form.php:209
111
msgid "Width & Height"
112
msgstr ""
113
114
+ #: includes/form.php:217
115
msgid "Thumbnail Alignment"
116
msgstr ""
117
118
+ #: includes/form.php:220
119
msgid "Left"
120
msgstr ""
121
122
+ #: includes/form.php:221
123
msgid "Right"
124
msgstr ""
125
126
+ #: includes/form.php:222
127
msgid "Center"
128
msgstr ""
129
130
+ #: includes/form.php:227
131
+ msgid ""
132
+ "Your theme does not support Post Thumbnail feature, please go to "
133
+ "%1$shttp://codex.wordpress.org/Post_Thumbnails%2$s to read more info and "
134
+ "how to activate it in your theme."
135
+ msgstr ""
136
+
137
+ #: includes/form.php:237
138
msgid "Display excerpt"
139
msgstr ""
140
141
+ #: includes/form.php:243
142
msgid "Excerpt Length"
143
msgstr ""
144
145
+ #: includes/form.php:251
146
msgid "Display Date"
147
msgstr ""
148
149
+ #: includes/form.php:258
150
msgid "Display Modified Date"
151
msgstr ""
152
153
+ #: includes/form.php:265
154
msgid "Use Relative Date. eg: 5 days ago"
155
msgstr ""
156
157
+ #: includes/form.php:275
158
msgid "Custom CSS"
159
msgstr ""
160
161
+ #: includes/form.php:278
162
msgid "You can find the plugin css selector on %1$sFAQ page%2$s."
163
msgstr ""
164
165
+ #: includes/functions.php:14 includes/widget.php:27
166
+ msgid "Random Posts"
167
msgstr ""
168
169
+ #: includes/posts.php:101 includes/posts.php:107
170
msgid "%s ago"
171
msgstr ""
172
173
+ #: includes/widget.php:17
174
+ msgid ""
175
+ "An advanced widget that gives you total control over the output of the "
176
+ "random posts."
177
+ msgstr ""
178
+
179
#. Plugin Name of the plugin/theme
180
+ msgid "Advanced Random Posts Widget"
181
msgstr ""
182
183
#. Plugin URI of the plugin/theme
184
+ msgid "https://wordpress.org/plugins/advanced-random-posts-widget/"
185
msgstr ""
186
187
#. Description of the plugin/theme
188
+ msgid "Easily to display advanced random posts via shortcode or widget."
189
msgstr ""
190
191
#. Author of the plugin/theme
192
+ msgid "Theme Junkie"
193
msgstr ""
194
195
#. Author URI of the plugin/theme
196
+ msgid "http://www.theme-junkie.com/"
197
+ msgstr ""
198
+
199
+ #: includes/form.php:34
200
+ msgctxt "widget tab name"
201
+ msgid "General"
202
+ msgstr ""
203
+
204
+ #: includes/form.php:35
205
+ msgctxt "widget tab name"
206
+ msgid "Posts"
207
+ msgstr ""
208
+
209
+ #: includes/form.php:36
210
+ msgctxt "widget tab name"
211
+ msgid "Taxonomy"
212
+ msgstr ""
213
+
214
+ #: includes/form.php:37
215
+ msgctxt "widget tab name"
216
+ msgid "Thumbnail"
217
+ msgstr ""
218
+
219
+ #: includes/form.php:38
220
+ msgctxt "widget tab name"
221
+ msgid "Extras"
222
+ msgstr ""
223
+
224
+ #: includes/form.php:39
225
+ msgctxt "widget tab name"
226
+ msgid "Custom CSS"
227
msgstr ""
languages/arpw-id_ID.mo DELETED
Binary file
languages/arpw-id_ID.po DELETED
@@ -1,182 +0,0 @@
1
- # Copyright (C) 2015 Satrya
2
- # This file is distributed under the same license as the Advanced Random Posts Widget package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Advanced Random Posts Widget 2.0.3\n"
6
- "Report-Msgid-Bugs-To: http://satrya.me/\n"
7
- "POT-Creation-Date: 2015-01-03 18:12:55+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2015-01-04 01:27+0700\n"
12
- "Last-Translator: Satrya <satrya@satrya.me>\n"
13
- "Language-Team: Satrya (satrya@satrya.me)\n"
14
- "X-Generator: Poedit 1.6.11\n"
15
- "Plural-Forms: nplurals=1; plural=0;\n"
16
- "X-Poedit-Basepath: ..\n"
17
- "X-Poedit-SourceCharset: utf-8\n"
18
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
19
- "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
20
- "X-Textdomain-Support: yes\n"
21
- "Language: id\n"
22
- "X-Poedit-SearchPath-0: .\n"
23
-
24
- #: classes/widget.php:23
25
- msgid ""
26
- "An advanced widget that gives you total control over the output of the "
27
- "random posts."
28
- msgstr ""
29
- "Widget yang memberikan anda kontrol penuh dengan hasil dan tampilan dari pos "
30
- "acak."
31
-
32
- #: classes/widget.php:34 includes/functions.php:20
33
- msgid "Random Posts"
34
- msgstr "Pos Acak"
35
-
36
- #: includes/form.php:17
37
- msgid "Title"
38
- msgstr "Judul"
39
-
40
- #: includes/form.php:24
41
- msgid "Title URL"
42
- msgstr "URL Judul"
43
-
44
- #: includes/form.php:31
45
- msgid "CSS Class"
46
- msgstr "CSS Class"
47
-
48
- #: includes/form.php:38
49
- msgid "HTML or text before the random posts"
50
- msgstr "HTML atau teks sebelum pos acak"
51
-
52
- #: includes/form.php:45
53
- msgid "HTML or text after the random posts"
54
- msgstr "HTML atau teks setelah pos acak"
55
-
56
- #: includes/form.php:57
57
- msgid "Ignore sticky posts"
58
- msgstr "Abaikan Pos Lengket"
59
-
60
- #: includes/form.php:63
61
- msgid "Number of posts to show"
62
- msgstr "Jumlah pos yang ditampilkan"
63
-
64
- #: includes/form.php:66
65
- msgid "to show all posts."
66
- msgstr "untuk menampilkan semua pos."
67
-
68
- #: includes/form.php:71
69
- msgid "Offset"
70
- msgstr "Offset"
71
-
72
- #: includes/form.php:74
73
- msgid "The number of posts to skip"
74
- msgstr "Jumlah pos yang dilewati"
75
-
76
- #: includes/form.php:79
77
- msgid "Post type"
78
- msgstr "Tipe Pos"
79
-
80
- #: includes/form.php:90
81
- msgid "Post status"
82
- msgstr "Status Pos"
83
-
84
- #: includes/form.php:101
85
- msgid "Limit to Category"
86
- msgstr "Batasi Berdasarkan Kategori"
87
-
88
- #: includes/form.php:117
89
- msgid "Limit to Tag"
90
- msgstr "Batasi Berdasarkan Tag"
91
-
92
- #: includes/form.php:133
93
- msgid "Limit to Taxonomy"
94
- msgstr "Batasi Berdasarkan Taxonomy"
95
-
96
- #: includes/form.php:136
97
- msgid "Ex: category=1,2,4&amp;post_tag=6,12"
98
- msgstr "Contoh: category=1,2,4&amp;post_tag=6,12"
99
-
100
- #: includes/form.php:137
101
- msgid "Available: "
102
- msgstr "Tersedia:"
103
-
104
- #: includes/form.php:150
105
- msgid "Display thumbnail"
106
- msgstr "Tampilkan Thumbnail"
107
-
108
- #: includes/form.php:156
109
- msgid "Thumbnail Size "
110
- msgstr "Ukuran Thumbnail"
111
-
112
- #: includes/form.php:163
113
- msgid "Please read %1$sFAQ%2$s for more information."
114
- msgstr "Silahkan baca halaman %1$sFAQ%2$s untuk informasi lebih lanjut."
115
-
116
- #: includes/form.php:169
117
- msgid "Use custom thumbnail sizes"
118
- msgstr "Gunakan ukuran thumbnail kustom"
119
-
120
- #: includes/form.php:175
121
- msgid "Width & Height"
122
- msgstr "Lebar & Tinggi"
123
-
124
- #: includes/form.php:183
125
- msgid "Thumbnail Alignment"
126
- msgstr "Penjajaran Thumbnail"
127
-
128
- #: includes/form.php:186
129
- msgid "Left"
130
- msgstr "Kiri"
131
-
132
- #: includes/form.php:187
133
- msgid "Right"
134
- msgstr "Kanan"
135
-
136
- #: includes/form.php:188
137
- msgid "Center"
138
- msgstr "Tengah"
139
-
140
- #: includes/form.php:197
141
- msgid "Display excerpt"
142
- msgstr "Tampilkan Excerpt"
143
-
144
- #: includes/form.php:203
145
- msgid "Excerpt Length"
146
- msgstr "Panjang Excerpt"
147
-
148
- #: includes/form.php:211
149
- msgid "Display Date"
150
- msgstr "Tampilkan Tanggal"
151
-
152
- #: includes/form.php:218
153
- msgid "Use Relative Date. eg: 5 days ago"
154
- msgstr "Gunakan Tanggal Relatif. contoh: 5 hari yang lalu"
155
-
156
- #: includes/functions.php:147
157
- msgid "Permalink to %s"
158
- msgstr "Permalink to %s"
159
-
160
- #: includes/functions.php:152
161
- msgid "%s ago"
162
- msgstr "%s yang lalu"
163
-
164
- #. Plugin Name of the plugin/theme
165
- msgid "Advanced Random Posts Widget"
166
- msgstr "Advanced Random Posts Widget"
167
-
168
- #. Plugin URI of the plugin/theme
169
- msgid "http://wordpress.org/plugins/advanced-random-posts-widget/"
170
- msgstr "http://wordpress.org/plugins/advanced-random-posts-widget/"
171
-
172
- #. Description of the plugin/theme
173
- msgid "Easy to display random posts via shortcode or widget."
174
- msgstr "Mudah untuk menampilkan pos acak via shortcode atau widget."
175
-
176
- #. Author of the plugin/theme
177
- msgid "Satrya"
178
- msgstr "Satrya"
179
-
180
- #. Author URI of the plugin/theme
181
- msgid "http://satrya.me/"
182
- msgstr "http://satrya.me/"
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Random Posts Widget Extended ===
2
- Contributors: satrya, themephe
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.7
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -11,13 +11,10 @@ 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:
18
19
- * Please see [FAQ](http://wordpress.org/plugins/advanced-random-posts-widget/faq/) page to read common questions.
20
- * Please see [Other Notes](http://wordpress.org/plugins/advanced-random-posts-widget/other_notes/) to read how to use shortcode.
21
22
= Features Include =
23
@@ -35,19 +32,13 @@ Before asking a support question:
35
* Add custom html or text before and/or after random posts.
36
* Multiple widgets.
37
38
- = Language =
39
- * English
40
- * Bahasa Indonesia
41
- * [Please contibute to submit your language](https://github.com/themephe/advanced-random-posts-widget/issues)
42
-
43
= Support =
44
45
* [Forum support](http://wordpress.org/support/plugin/advanced-random-posts-widget).
46
* [Rate/Review the plugin](http://wordpress.org/support/view/plugin-reviews/advanced-random-posts-widget).
47
- * [Submit translation](https://github.com/themephe/advanced-random-posts-widget/issues).
48
- * [Contribute on Github](https://github.com/themephe/advanced-random-posts-widget/)
49
50
- > Developed by [ThemePhe](https://themephe.com/) in Indonesia
51
52
== Installation ==
53
@@ -130,25 +121,38 @@ Display 10 random posts
130
131
Display with thumbnail and set the size
132
`
133
- [arpw thumbnail="true" thumbnail_size="thumbnail"]
134
`
135
136
**Here's the full default shortcode arguments**
137
`
138
title=""
139
- title_url=""
140
offset=""
141
limit="5"
142
post_type="post"
143
post_status="publish"
144
ignore_sticky="1"
145
taxonomy=""
146
thumbnail="false"
147
thumbnail_size="arpw-thumbnail"
148