Skip to content

Commit

Permalink
add has_password parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
billerickson committed Jan 7, 2019
1 parent 1a57356 commit a11e02e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file, formatted v
### [3.0.0]
#### Added
* Added author_id parameter, see #195
* Added has_password parameter
* Added s parameter for performing a site search, see #184
* Added date_format="relative" format option (ex: 2 days ago), see #194
* Added post_parent__in and post_parent__not_in parameters, see #193
Expand Down
6 changes: 6 additions & 0 deletions display-posts-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function be_display_posts_shortcode( $atts ) {
'excerpt_more_link' => false,
'exclude' => false,
'exclude_current' => false,
'has_password' => null,
'id' => false,
'ignore_sticky_posts' => false,
'image_size' => false,
Expand Down Expand Up @@ -118,6 +119,7 @@ function be_display_posts_shortcode( $atts ) {
$excerpt_more_link = filter_var( $atts['excerpt_more_link'], FILTER_VALIDATE_BOOLEAN );
$exclude = $atts['exclude']; // Sanitized later as an array of integers
$exclude_current = filter_var( $atts['exclude_current'], FILTER_VALIDATE_BOOLEAN );
$has_password = null !== $atts['has_password'] ? filter_var( $atts['has_password'], FILTER_VALIDATE_BOOLEAN ) : null;
$id = $atts['id']; // Sanitized later as an array of integers
$ignore_sticky_posts = filter_var( $atts['ignore_sticky_posts'], FILTER_VALIDATE_BOOLEAN );
$image_size = sanitize_key( $atts['image_size'] );
Expand Down Expand Up @@ -255,6 +257,10 @@ function be_display_posts_shortcode( $atts ) {
if( $ignore_sticky_posts )
$args['ignore_sticky_posts'] = true;

// Password protected content
if( null !== $has_password )
$args['has_password'] = $has_password;

// Meta key (for ordering)
if( !empty( $meta_key ) )
$args['meta_key'] = $meta_key;
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Here are [tutorials for popular event calendar plugins](https://displayposts.com

**Version 3.0.0**
* Added author_id parameter, see [#195](https://github.com/billerickson/display-posts-shortcode/issues/195)
* Added has_password parameter
* Added s parameter for performing a site search, see [#184](https://github.com/billerickson/display-posts-shortcode/issues/184)
* Added date_format="relative" format option (ex: 2 days ago), see [#194](https://github.com/billerickson/display-posts-shortcode/issues/194)
* Added post_parent__in and post_parent__not_in parameters, see [#193](https://github.com/billerickson/display-posts-shortcode/issues/193)
Expand Down

0 comments on commit a11e02e

Please sign in to comment.