From 9a34dc58272adbada81b0f4e7d1daa0ad6b3cf8f Mon Sep 17 00:00:00 2001 From: Der Mundschenk & Compagnie Date: Mon, 19 Feb 2018 22:18:20 +0100 Subject: [PATCH] Print end credits on pages, too. Fixes #30. --- README.md | 9 +++++---- public/class-media-credit-public.php | 4 ++-- readme.txt | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8b1bc1d6..1c2d27d7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Media Credit # **Contributors:** [pputzer](https://profiles.wordpress.org/pputzer) **Tags:** media, image, images, credit, byline, author, user -**Requires at least:** 4.8 -**Tested up to:** 4.8 +**Requires at least:** 4.9 +**Tested up to:** 4.9 **Stable tag:** 3.1.7 Adds a "Credit" field when uploading media to posts and displays it under the images @@ -127,7 +127,8 @@ by leaving a message in the Wordpress.org [support forums here](https:// ## Changelog ## -### 3.2.0 (Jun. xx, 2017) ### +### 3.2.0 (Feb. xx, 2018) ### +* "Display credit after posts" now works with pages as well as regular posts (and custom post types). * ### 3.1.7 (Feb. 24, 2017) ### @@ -141,7 +142,7 @@ by leaving a message in the Wordpress.org [support forums here](https:// ### 3.1.5 (Jan. 29, 2017) ### * Prevent invalid link nesting in featured image credits. This means that by default, - no `` tags are printed for featured image credits. The old behaviour can + no `` tags are printed for featured image credits. The old behavior can be restored by including `add_filter( 'media_credit_post_thumbnail_include_links', __return_true );` in the theme's `functions.php`. * "Display credit after posts" is now restricted to the proper single post view diff --git a/public/class-media-credit-public.php b/public/class-media-credit-public.php index 76fb4828..57c50419 100644 --- a/public/class-media-credit-public.php +++ b/public/class-media-credit-public.php @@ -283,8 +283,8 @@ public function media_credit_shortcode( $atts, $content = null ) { */ public function add_media_credits_to_end( $content ) { - // Check if we're inside the main loop in a single post page. - if ( ! is_single() || ! in_the_loop() || ! is_main_query() ) { + // Check if we're inside the main loop in a single post/page/CPT. + if ( ! is_singular() || ! in_the_loop() || ! is_main_query() ) { return $content; // abort. } diff --git a/readme.txt b/readme.txt index ed395cea..93cea67e 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: pputzer Tags: media, image, images, credit, byline, author, user Requires at least: 4.9 -Tested up to: 4.8 +Tested up to: 4.9 Stable tag: 3.1.7 Adds a "Credit" field when uploading media to posts and displays it under the images @@ -121,7 +121,8 @@ by leaving a message in the Wordpress.org [support forums here](https:// == Changelog == -= 3.2.0 (Jun. xx, 2017) = += 3.2.0 (Feb. xx, 2018) = +* "Display credit after posts" now works with pages as well as regular posts (and custom post types). * = 3.1.7 (Feb. 24, 2017) = @@ -135,7 +136,7 @@ by leaving a message in the Wordpress.org [support forums here](https:// = 3.1.5 (Jan. 29, 2017) = * Prevent invalid link nesting in featured image credits. This means that by default, - no `` tags are printed for featured image credits. The old behaviour can + no `` tags are printed for featured image credits. The old behavior can be restored by including `add_filter( 'media_credit_post_thumbnail_include_links', __return_true );` in the theme's `functions.php`. * "Display credit after posts" is now restricted to the proper single post view