Posts in Sidebar 4.2.0 released

A new version of Posts in Sidebar has just been released. Not so big news, but a little new option has been added to display the modification time, either for the post date and for the post modification date.

This new option was requested in the plugin’s forum by a user and I immediately added it. This feature had to be there from the first release — probably nobody needed this until now!

From the changelog

### 4.2.0 ###

* Added option to display the post time and modification time.
* Aligned shortcode options to main options.
* Comments are not linked to comments section in the post by default.

Update and enjoy!

Posts in Sidebar 4.1 released

After only two weeks from the last release, a new version of Posts in Sidebar has been published. The new version adds an option to get posts by recent comments and an option to display all the custom fields of a post.

Get posts by recent comments

The new option “Get posts by recent comments”.

Now you can display the posts where readers have left their recent comments. So, if a reader has just left a comment in a certain post, that post will be displayed on top of others. This is a forum-like behavior, that has been requested by some users of the plugin. As of today, WordPress hasn’t this capability, so I have added a specific function to make a custom query to the database. When you activate this option, other parameters will be ignored, namely these:

  • order: the order will be descending, because we want to display the most recent commented posts first;
  • order by: the “order by” option will be post__in, because WordPress must display the posts in an exact order of IDs;
  • post status: obviously we want only published posts.

Display all the custom fields

The new option “Display all the custom fields”.

In Posts in Sidebar there is an old option to display a specific custom field. In this new release I’ve added the possibility to display all the custom fields of a post. I certain sites it’s perfect to display all these extra informations. From 4.1 this plugin can do that.

All custom fields lines have two CSS classes: one standard pis-custom-field and one with a leading pis- plus the name of the custom field key, according to this schema:

<p class="pis-custom-field pis-{name of the custom field}">

So, for example, if we have a custom field “Price” with a value of “$15.00”, this will be the resulting HTML code:

<p class="pis-custom-field pis-price">
	<span class="pis-custom-field-key">Price</span>
	<span class="pis-custom-field-divider">:</span>
	<span class="pis-custom-field-value">$15.00</span>

In this situation you can make a precise styling of every line, or even hide certain lines or single elements.

Hope you find Posts in Sidebar more and more useful at every new release. Enjoy!

Posts in Sidebar 4.0 is available

I just released a new version of Posts in Sidebar plugin and it’s live on the WordPress repository just now. After 3 weeks from the last release, a new version brings new capabilities in using the power of WordPress for retrieving your posts. These are the new items from the changelog:

  1. Added section for retrieving posts from multiple custom fields. Until now you were able to get posts with a single custom field and/or value. Now you can put in relation multiple custom fields, as per WP_Query capability.
  2. Added option for retrieving posts with/without password. This is a totally new option, and you can get posts that have a password, or posts that haven’t a password, or posts either with password and without a password (i.e. all posts), as per WP_Query capability.
  3. Added option for retrieving posts with a certain password. You can get posts with a certain password. The previous options is not related with this field, so it’s enough you enter directly a password and WordPress will give you posts that have that password, as per WP_Query capability.
  4. Now panels do not collapse after saving the widget. This is a long waited enhancement for the UI of the plugin. As you know, when you save the widget after having opened a lot of panels, the panels get closed after the refresh. Now the panels remain in the state they were before pressing the Save button.

If you like this plugin, do not forget to leave a review and, if you can, make a donation. This would be very appreciated. :)

Posts in Sidebar 1.19

Yesterday I released Posts in Sidebar 1.19 that contains a requested change. Before 1.19 you have had a dropdown menu in order to select the category or the tag but, if you had a large number of terms, the page would take a lot of time to load.

Some of the users of this plugin asked me to change this. The change has come and now categories and tags will be chosen using a simple text field, where you have to enter the IDs or the slugs of the terms, in the way I’ll explain here.

Posts retrieving


In the “Posts retrieving” section the categories and tags are now chosen manually by entering their respective slugs (i.e., the short form generated by WordPress). To find these slugs, go to the categories/tags management and search there for the terms.

Obviously, this is not as simple as before, but it’s necessary in order to avoid slow page loading.

A benefit of this change is that now you can retrieve posts from multiple terms. Before 1.19 you got posts from one category and/or one tag, now you can get posts from multiple categories and multiple tags (for example, posts that are in “Category 1” or in “Category 2” or in “Category 3”, and so on). In order to do that, simply enter the slugs separated by comma, for example:


Also, you can get posts that are under two or more categories at the same time. In order to do that, simply use a + (a plus) between terms, for example:


This was not possible before 1.19.

Posts exclusion


In the posts exclusion section, I removed the two forms and added two simple text fields. In this case you will not use the slugs of the terms but their IDs. In order to easily find the IDs of the terms, install a plugin like Reveal IDs: this plugin will add a column in the page management of terms.

Even in this section of the widget, you can use a comma to separate each term or a plus sign, as described before.


After updating the plugin, it’s better to take a look at the widget of Posts in Sidebar and make sure all is OK. If all seems to be right, save the widget anyway.

In fact, in this version change, you could encounter a couple of “issues”, that can be easily resolved:

  1. If in the previous version you didn’t specify a category or a tag in the “Post retrieving” section, after updating you will find a “NULL” value. Simply delete this value and save the widget.
  2. If in the previous version you specified a category or a tag in the “Post exclusion” section, simply save the widget.

For any question or help, please use the WordPress forum.

New features in Posts in Sidebar

This is a Saturday of updates! After having released v.2.2 of Private Content plugin, now I’m proud to introduce you the just-cooked 1.8 version of Posts in Sidebar. Just last week I released the v1.7 with important new features like the possibility to show not only posts but also pages and custom post types. This week you’ll get the last missing features and this is the changelog for the new v1.8 of Posts in Sidebar:

  1. New: added post format as option to get posts.
  2. New: added option for link to custom post type archive.
  3. New: added option for link to post format archive.
  4. Other minor changes.

Only one function is now missing: grab posts using custom taxonomies. Hope to finish this work soon.

Enjoy! :)

Private content reaches v2.2

One of the frequently asked questions the users of my plugin Private Content do is the following:

Is there a way to display an alternate text to readers that haven’t the rights to read the hidden text

I’ve always answered that this plugin was designed to show only a simple note to the subscribers/collaborators, leaving other members/visitors out of any type of message. But often a developer can’t imagine all the possible usages a piece of software can encounter. This plugin, clearly, is used not only to display private notes/messages to some people, but also to display an alternative text if these readers haven’t the rights to read that note/message.

I’ve been always opposed to add this feature, but today I added it to Private Content. So, if you asked for it, update the plugin to version 2.2.


As usual write the to-be-hidden sentence wrapped into the shortcode, but add option alt, for example:

[private role="author" alt="Sorry, but you have not rights to read this."]Secret text for authors[/private]

In this way Authors (and higher members, like Editors and Amministrators) will read this, while lower members will read only Sorry, but you have not rights to read this.


Posts in Sidebar 1.7

New 1.7 version of the Posts in Sidebar plugin.

The Posts in Sidebar plugin has just been updated to version 1.7 and now it sports a series of changes. From day to day I receive requests both in the forum and via email from users who launch their idea. I think this is a very good thing for developers. The plugin is constantly evolving, also thanks to these suggestions.

The new version has this changelog:

  1. The plugin now can display not only posts, but also pages and custom post types.
  2. Now the author of the post can be displayed next to the date and comments.
  3. The content of the posts can now be displayed as Full content, meaning that the post is displayed as in a single post page (useful for a video-only posts, for example).
  4. The link at the end of the excerpt can now be displayed as Read more… (or whatever the user wants).
  5. Added French translation, thanks to Thérèse Lachance.

Many other changes have been done. What remains to do is:

  1. retrieve posts via posts format;
  2. retrieve posts via custom taxonomies.

I hope to have the time to do that. :)

Private content 2.1

A new version of my Private Content plugin has just been released! The new 2.1 version lets you show a note only to visitors and hide it to other users. So the shortcode now accepts this role:

[private role="visitor-only"]Text for Visitors only[/private]

As you probably know, there isn’t a role for Visitors. So, to accomplish this, the plugin makes a check if the user is logged in: if not, the note will be displayed and hidden to other logged-in users (Subscribers, Authors, and so on). Here the new code:

case 'visitor-only' :
    if ( ! is_user_logged_in() )
        $text = '<p class="private visitor-content visitor-only"' . $align_style . '>' . $content . '</p>';

As usual, the p element has an its own class, so you can stylize it as you like via CSS.

This new feature has been added thanks to Jacki, a reader of my Italian blog, who left a comment with this new idea.

Delicious Readings plugin goes 2.0

Yesterday I pushed to the WordPress repository a new version of my plugin Delicious Readings. If you don’t know this plugin, Delicious Readings lets you publish on your blog a collection of Delicious bookmarks stored with a particular tagged of your choice. So, for example, you can publish your bookmarks stored under “readings” or “pets” or “sushi” and so on.

The new version 2.0 adds the shortcode, in order to publish this list on a page or on a post. The idea comes from a user on the WordPress forums, who asked if there were the possibility to publish this list on a page rather than on a widget in the sidebar (already full of stuff). I was replying that he could call the plugin’s main function directly in the PHP code, but I thought it were better to add a shortcode for use in the writing panel.

Usage as shortcode

The shortcode accepts the full range of options of the core function. The only mandatory option is the address of the feed. So, for example, if your username is joe and the tag is books the shortcode will be:

[dreadings feed_url=""]

The plugin will show the last 5 bookmarks by default. If you want to show 10 bookmarks, change the shortcode as follows:

[dreadings feed_url="" quantity=10]

The tags aren’t displayed by default. If you want to show them, change the line in this way:

[dreadings feed_url="" quantity=10 display_tags=true]

This is the full set of options you can use (the value shown here is the default one):

date_text="Stored on:"
archive_text="More posts"

Change default values according to your needs.

Usage as PHP function

As I already said, you can use the plugin calling the main function directly in your PHP files:

<?php if ( function_exists( 'dr_fetch_feed' ) ) {
    $args = array(
        'feed_url'         => '',
        'quantity'         => 5,
        'display_desc'     => false,
        'truncate'         => 0,
        'display_date'     => false,
        'date_text'        => 'Stored on:',
        'display_tags'     => false,
        'tags_text'        => 'Tags:',
        'display_hashtag'  => true,
        'display_arrow'    => false,
        'display_archive'  => true,
        'archive_text'     => 'More posts',
        'display_arch_arr' => true,
        'new_tab'          => false,
        'nofollow'         => true,
    dr_fetch_feed( $args );
} ?>

Make sure to check if the opening <?php and closing ?> PHP tags are needed in your code. This is the full range of options — you can obviously use only those who need change.

The plugin is available on the WordPress repository and on GitHub.

Private content 2.0

My plugin Private Content has been updated to 2.0 and now you have a new feature: the possibility to exclude an higher role’s user from reading a lower role’s content. In other words, when in version below 2.0 we created a note for Subscribers, the higher roles could read this notes — and also in version 2.0 it works in the same way. But now it’s possible to hide a note to an Administrator, for example, and only the targeted group of users can read it, e.g. the Authors group.

How did I accomplish that?

The plugin creates a new capability for each role, obviously excluding the Administrator role:

function ubn_private_add_cap() {
    global $wp_roles;
    $wp_roles->add_cap( 'editor',      'read_ubn_editor_notes'      );
    $wp_roles->add_cap( 'author',      'read_ubn_author_notes'      );
    $wp_roles->add_cap( 'contributor', 'read_ubn_contributor_notes' );
    $wp_roles->add_cap( 'subscriber',  'read_ubn_subscriber_notes'  );
register_activation_hook( __FILE__, 'ubn_private_add_cap' );

The new capabilites are created on plugin activation and with this we are all done. But what in case of upgrading from versions below 2.0?

In case of upgrading, the plugin performs another check:

function ubn_private_check_capability_exists() {
    $editor_role = get_role( 'editor' );
    if ( ! isset( $editor_role->capabilities['read_ubn_editor_notes'] ) ) {
add_action( 'init', 'ubn_private_check_capability_exists' );

It looks for the presence of the capability read_ubn_editor_notes and, if it’s not in the database, the plugin will run the function for adding the new capabilities.

As usual, I’ve added the uninstall.php file to delete the new capabilities from the database: we all like to have and keep it clean. Something that every plugin develper should do.

This plugin is hosted in the WordPress repository, but you can find the development version on GitHub. Forks are welcome! :)