Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Commit e644e68

Browse files
committed
Merge branch 'develop'
2 parents 9561a73 + af413ed commit e644e68

10 files changed

Lines changed: 876 additions & 720 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [4.15.0] - 2020-03-06
11+
### Added
12+
* Added compatibility with Yoast SEO plugin when determining the main category of a post.
13+
### Changed
14+
* Cleaned and beautified HTML source code.
15+
* Updated compatibility to WordPress 5.7.
16+
1017
## [4.14.0] - 2020-11-21
1118
### Added
1219
* Added new links to plugin line in the WordPress plugins management page.
@@ -610,6 +617,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
610617
* First release of the plugin.
611618

612619
[Unreleased]: https://github.com/aldolat/posts-in-sidebar/commits/develop
620+
[4.15.0]: https://github.com/aldolat/posts-in-sidebar/compare/4.14.0...4.15.0
613621
[4.14.0]: https://github.com/aldolat/posts-in-sidebar/compare/4.13.0...4.14.0
614622
[4.13.0]: https://github.com/aldolat/posts-in-sidebar/compare/4.12.1...4.13.0
615623
[4.12.1]: https://github.com/aldolat/posts-in-sidebar/compare/4.12.0...4.12.1

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
![banner](https://ps.w.org/posts-in-sidebar/assets/banner-772x250.png)
44

5-
**Contributors:** aldolat
6-
**Donate link:** <https://dev.aldolat.it/projects/posts-in-sidebar/>
7-
**Tags:** post, sidebar, widget, query, wp_query
8-
**Requires at least:** 4.6
9-
**Tested up to:** 5.6
10-
**Stable tag:** 4.14.0
11-
**License:** GPLv3 or later
12-
**License URI:** <https://www.gnu.org/licenses/gpl-3.0.html>
5+
**Contributors:** aldolat
6+
**Donate link:** <https://dev.aldolat.it/projects/posts-in-sidebar/>
7+
**Tags:** post, sidebar, widget, query, wp_query
8+
**Requires at least:** 4.6
9+
**Tested up to:** 5.7
10+
**Stable tag:** 4.15.0
11+
**License:** GPLv3 or later
12+
**License URI:** <https://www.gnu.org/licenses/gpl-3.0.html>
1313

1414
This plugin adds a widget to display a list of posts in the WordPress sidebar.
1515

@@ -24,6 +24,8 @@ This plugin adds a widget to display a list of posts in the WordPress sidebar.
2424
* [License](#license)
2525
* [Credits](#credits)
2626
* [Privacy Policy](#privacy-policy)
27+
* [Changelog](#changelog)
28+
* [4.15.0](#4150)
2729

2830
## Description
2931

@@ -100,6 +102,23 @@ This software is released under the terms of the [GNU GPLv3](https://github.com/
100102

101103
I would like to say *Thank You* to all the people who helped me in making this plugin better and translated it into their respective languages.
102104

105+
This plugin uses the following Javascript code, released under the terms of the GNU GPLv2 or later:
106+
107+
* a modified version of @kometschuh's code for "Category Posts Widget" plugin, used to open and close panels in the widget admin user interface;
108+
* a modified version of @themesfactory's code for "Duplicate Widgets" plugin, used to duplicate a widget.
109+
110+
Thanks to these developers for their work and for using the GNU General Public License.
111+
103112
## Privacy Policy
104113

105114
This plugin does not collect any user data.
115+
116+
## Changelog
117+
118+
### 4.15.0
119+
120+
* Added compatibility with Yoast SEO plugin when determining the main category of a post.
121+
* Cleaned and beautified HTML source code.
122+
* Updated compatibility to WordPress 5.7.
123+
124+
The full changelog is documented in the changelog file released along with the plugin package and is hosted on [GitHub](https://github.com/aldolat/posts-in-sidebar/blob/master/CHANGELOG.md).

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
== Changelog ==
22

3+
= 4.15.0 =
4+
5+
* Added compatibility with Yoast SEO plugin when determining the main category of a post.
6+
* Cleaned and beautified HTML source code.
7+
* Updated compatibility to WordPress 5.7.
8+
39
= 4.14.0 =
410

511
* Added new links to plugin line in the WordPress plugins management page.

includes/class-pis-posts-in-sidebar.php

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ public function widget( $args, $instance ) {
107107
*/
108108
echo "\n" . '<!-- Start Posts in Sidebar - ' . esc_html( $args['widget_id'] ) . ' -->' . "\n";
109109

110-
echo $args['before_widget'];
110+
echo $args['before_widget'] . "\n";
111111

112112
// Add a new container if the "Container Class" is not empty.
113113
if ( ! empty( $instance['container_class'] ) ) {
114-
echo '<div class="' . sanitize_html_class( $instance['container_class'] ) . '">';
114+
echo '<div class="' . sanitize_html_class( $instance['container_class'] ) . '">' . "\n";
115115
}
116116

117117
/*
118118
* Echo the title, along with link, if present.
119119
*/
120120
if ( $instance['title'] && ! empty( $instance['title_link'] ) ) {
121-
echo $args['before_title'] . '<a class="pis-title-link" href="' . esc_url( $instance['title_link'] ) . '">' . $instance['title'] . '</a>' . $args['after_title'] . "\n";
121+
echo $args['before_title'] . '<a class="pis-title-link" href="' . esc_url( $instance['title_link'] ) . '">' . $instance['title'] . '</a>' . $args['after_title'];
122122
} elseif ( $instance['title'] ) {
123-
echo $args['before_title'] . $instance['title'] . $args['after_title'] . "\n";
123+
echo $args['before_title'] . $instance['title'] . $args['after_title'];
124124
}
125125

126126
/*
@@ -130,12 +130,12 @@ public function widget( $args, $instance ) {
130130
pis_posts_in_sidebar( $instance );
131131

132132
if ( ! empty( $instance['container_class'] ) ) {
133-
echo '</div>';
133+
echo '</div>' . "\n";
134134
}
135135

136-
echo $args['after_widget'];
136+
echo $args['after_widget'] . "\n";
137137

138-
echo "\n" . '<!-- End Posts in Sidebar - ' . esc_html( $args['widget_id'] ) . ' -->' . "\n\n";
138+
echo '<!-- End Posts in Sidebar - ' . esc_html( $args['widget_id'] ) . ' -->' . "\n\n";
139139
}
140140

141141
/**
@@ -241,6 +241,7 @@ public function update( $new_instance, $old_instance ) {
241241
}
242242
$instance['title_same_cat'] = wp_strip_all_tags( $new_instance['title_same_cat'] );
243243
$instance['sort_categories'] = isset( $new_instance['sort_categories'] ) ? 1 : 0;
244+
$instance['yoast_main_cat'] = isset( $new_instance['yoast_main_cat'] ) ? 1 : 0;
244245
$instance['orderby_same_cat'] = $new_instance['orderby_same_cat'];
245246
$instance['order_same_cat'] = $new_instance['order_same_cat'];
246247
$instance['offset_same_cat'] = absint( wp_strip_all_tags( $new_instance['offset_same_cat'] ) );
@@ -822,7 +823,7 @@ public function form( $instance ) {
822823
$this->get_field_name( 'intro' ),
823824
$instance['intro'],
824825
esc_html__( 'These posts are part of my Readings series.', 'posts-in-sidebar' ),
825-
$style = 'resize: vertical; width: 100%; height: 80px;'
826+
'resize: vertical; width: 100%; height: 80px; min-height: 80px;'
826827
);
827828
?>
828829

@@ -1154,6 +1155,47 @@ public function form( $instance ) {
11541155

11551156
<div class="pis-container">
11561157

1158+
<p class="pis-boxed pis-boxed-light-blue">
1159+
<em>
1160+
<strong>
1161+
<?php
1162+
esc_html_e( 'How this plugin chooses the main category of the post.', 'posts-in-sidebar' );
1163+
?>
1164+
</strong>
1165+
<br />
1166+
<br />
1167+
<?php
1168+
esc_html_e(
1169+
'When the option "When on single posts, get posts from the current category" is activated and the post has multiple categories, Posts in Sidebar will choose the category with the lowest initial letter, just as WordPress does when we get the list of the categories of a post.', 'posts-in-sidebar'
1170+
);
1171+
?>
1172+
<br />
1173+
<br />
1174+
<?php
1175+
printf(
1176+
// translators: Opening and closing "strong" HTML tag.
1177+
esc_html__(
1178+
'If you activate the option %1$s"Use the main category as WordPress does for permalinks"%2$s (formerly known here as "Sort categories"), Posts in Sidebar will get the category with the lowest category ID. This is the WordPress behaviour when it determines the permalink structure if the category is used in the permalink.', 'posts-in-sidebar'
1179+
),
1180+
'<strong>',
1181+
'</strong>'
1182+
);
1183+
?>
1184+
<br />
1185+
<br />
1186+
<?php
1187+
printf(
1188+
// translators: Opening and closing "strong" HTML tag.
1189+
esc_html__(
1190+
'If you use the Yoast SEO plugin and want to use the main category as defined with that plugin, activate the option %1$s"Use the main category as defined in the Yoast SEO plugin"%2$s.', 'posts-in-sidebar'
1191+
),
1192+
'<strong>',
1193+
'</strong>'
1194+
);
1195+
?>
1196+
</em>
1197+
</p>
1198+
11571199
<div class="pis-column-container">
11581200

11591201
<div class="pis-column">
@@ -1165,7 +1207,27 @@ public function form( $instance ) {
11651207
$this->get_field_id( 'get_from_same_cat' ),
11661208
$this->get_field_name( 'get_from_same_cat' ),
11671209
$instance['get_from_same_cat'],
1168-
esc_html__( 'When activated, this function will get posts from the category of the post, ignoring other parameters like tags, date, post formats, etc. If the post has multiple categories, the plugin will use the first category in the array of categories (the category with the lowest initial letter). If you don\'t want to ignore other parameters, activate the checkbox below, at the end of this panel.', 'posts-in-sidebar' )
1210+
esc_html__( 'When activated, this option will ignore other parameters like tags, date, post formats, etc. If you don\'t want to ignore other parameters, activate the checkbox below, at the end of this panel.', 'posts-in-sidebar' )
1211+
);
1212+
?>
1213+
1214+
<?php
1215+
// ================= Sort categories
1216+
pis_form_checkbox(
1217+
esc_html__( 'Use the main category as WordPress does for permalinks', 'posts-in-sidebar' ),
1218+
$this->get_field_id( 'sort_categories' ),
1219+
$this->get_field_name( 'sort_categories' ),
1220+
$instance['sort_categories']
1221+
);
1222+
?>
1223+
1224+
<?php
1225+
// ================= Yoast main category
1226+
pis_form_checkbox(
1227+
esc_html__( 'Use the main category as defined in the Yoast SEO plugin', 'posts-in-sidebar' ),
1228+
$this->get_field_id( 'yoast_main_cat' ),
1229+
$this->get_field_name( 'yoast_main_cat' ),
1230+
$instance['yoast_main_cat']
11691231
);
11701232
?>
11711233

@@ -1193,17 +1255,6 @@ public function form( $instance ) {
11931255
);
11941256
?>
11951257

1196-
<?php
1197-
// ================= Sort categories
1198-
pis_form_checkbox(
1199-
esc_html__( 'Sort categories', 'posts-in-sidebar' ),
1200-
$this->get_field_id( 'sort_categories' ),
1201-
$this->get_field_name( 'sort_categories' ),
1202-
$instance['sort_categories'],
1203-
esc_html__( 'When activated, this function will sort the categories of the main post so that the category, where the plugin will get posts from, will match the main category of the main post, i.e. the category with the lowest ID.', 'posts-in-sidebar' )
1204-
);
1205-
?>
1206-
12071258
</div>
12081259

12091260
<div class="pis-column">
@@ -4708,7 +4759,7 @@ public function form( $instance ) {
47084759
$this->get_field_name( 'custom_styles' ),
47094760
$instance['custom_styles'],
47104761
esc_html__( 'Enter here your CSS styles', 'posts-in-sidebar' ),
4711-
$style = 'resize: vertical; width: 100%; height: 80px;'
4762+
'resize: vertical; width: 100%; height: 80px; min-height: 80px;'
47124763
);
47134764
?>
47144765

0 commit comments

Comments
 (0)