From b1806dcebac7f58182cfb498c2b07c174ae8c5d1 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:56:30 +0200 Subject: [PATCH] Change include_protected to ignore_protected Follows the WP default query better. --- DOCUMENTATION.md | 2 +- includes/functions/_shortcodes.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 27ad9106..dfe85e06 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -390,7 +390,7 @@ Renders paginated blog posts akin to the default blog page, but with options. Ma * **per_page:** Number of posts per page. Defaults to theme settings. * **ignore_sticky:** Whether sticky posts should be ignored or not. Default `false`. -* **include_protected:** Whether protected posts should be included or not. Default `false`. +* **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **author:** Only show posts of a specific author. Make sure to write the name right. * **author_ids:** Only show posts of a comma-separated list of author IDs. * **exclude_author_ids:** Comma-separated list of author IDs to exclude. diff --git a/includes/functions/_shortcodes.php b/includes/functions/_shortcodes.php index fb5d0a48..b1c90941 100644 --- a/includes/functions/_shortcodes.php +++ b/includes/functions/_shortcodes.php @@ -1355,7 +1355,7 @@ function fictioneer_shortcode_blog( $attr ) { $exclude_author_ids = fictioneer_explode_list( $attr['exclude_author_ids'] ?? '' ); $author_ids = fictioneer_explode_list( $attr['author_ids'] ?? '' ); $ignore_sticky = filter_var( $attr['ignore_sticky'] ?? 0, FILTER_VALIDATE_BOOLEAN ); - $include_protected = filter_var( $attr['include_protected'] ?? 0, FILTER_VALIDATE_BOOLEAN ); + $ignore_protected = filter_var( $attr['ignore_protected'] ?? 0, FILTER_VALIDATE_BOOLEAN ); $rel = 'AND'; $classes = ''; @@ -1416,7 +1416,7 @@ function fictioneer_shortcode_blog( $attr ) { } // Exclude protected - if ( ! $include_protected ) { + if ( $ignore_protected ) { add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' ); }