After more than 80 commits, many hours of work and a lot of love, Posts in Sidebar 4.7.0 has landed in the WordPress repository! I hope you find useful the new additions and the rest of what has been done. Let’s see what’s new dissecting the changelog.
From the changelog
* Added new option to filter posts in the same category/tag/author/custom-field by searching for the title of the main post.
* Added "Post type", "Relevance (when searching)", and "Preserve post parent order" in "Order posts by" option.
* Added new options when changing the query in single posts or in an archive page. ### Changed
* Now custom post types are supported when changing query in single posts.
* Reorganized some sub-panels and added colors in panel titles.
* Checked all files with WordPress Coding Standard for PHPCS.
* Removed old comment for HTML in widget introduction.
* Fixed displaying the query in debug section when the query contains multidimensional arrays.
* Hardened security.
Added new option to filter posts in the same category/tag/author/custom-field by searching for the title of the main post
Coming from a request in the forum, this option lets you to get posts that:
- have been published under the same category or tag of the main post or by the same author or that have the same custom field;
- have a certain relation with the title of the main post.
In other words, while we are reading a post, the sidebar can show the reader a list of posts that are related to the main post because, for example, have the same category and contains something that has to do with the title of the main post.
According to the author of the thread in the forum, this should have a positive impact on the SEO.
Added “Post type”, “Relevance (when searching)”, and “Preserve post parent order” in “Order posts by” option
In “Getting posts” > “Order posts by”
- Post type: order by post type;
- Relevance: when displaying posts based on a
search, the posts can be ordered on relevance, like WordPress itself does when you search for something on your site.
- Preserve post parent order: in conjunction with the option “Getting posts” > “Get posts whose parent is in these IDs”, this option maintains the order in which the IDs were entered.
Added new options when changing the query in single posts or in an archive page
The sections “Change the query when on single posts” and “Change the query when on archive page” have been updated with new options. Now you can sort the posts based on some criteria, almost the same as in the previous paragraph.
Now custom post types are supported when changing
the query in single posts
The section Change the query when
Reorganized some sub-panels and added colors in panel titles
Finally, I made it! The panel of this widget is so full of subpanels that I decided to add some colors to distinguish better the various levels.
Also, I increased the thickness of
I chose this hierarchy of colors:
I hope you like this visual change.
Checked all files with WordPress Coding Standard for PHPCS
WordPress has a detailed manual for developers, where (almost?) every aspect of writing code is covered. The WordPress Coding Standards are here to help developers to write a more human-readable code. Since humans are not perfect, this set of rules has been made available for PHP Code Sniffer, which checks for code smells on the fly, very handy, especially using a plugin for Atom editor. In the code
Removed old comment for HTML in widget introduction
As you know, starting with version 4.6.0, the widget introduction accepts more HTML tags. I forgot to remove the old comment from the text field before pushing the final release, but now it has been removed. Sorry
Fixed displaying the query in debug section when the query contains multidimensional arrays
If the query contained a complex query, such as “Custom taxonomy query”, or “Date query”, etc., the debug section (if activated) displayed a string like this:
The bug has been fixed and now it could display something complex like this:
or like this:
compare: NOT LIKE
compare: NOT LIKE
or even more complex queries. The indentation should help you in case you need to investigate.
Security is at the top of every serious developer. WordPress gives them all sort of functions to make sure that every line of code is safe. For this reason, I checked extensively the plugin searching for every possible weakness. The PHPCS and the set of rules of WPCS gave me a huge help on this.