Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Make sure warnings aren't triggered by no IDs.
Browse files Browse the repository at this point in the history
Make sure that other plugins that try to filter `the_title` without passing in two parameters don't interfere with the Subtitles plugin. When `the_title` is filtered, two parameters are needed by Subtitles: the title of the post and the post ID.

If a custom widget or anything else that uses `the_title` does not provide this, then Subtitles will return a PHP warning. So, set the default ID to null if it hasn't been passed to `the_subtitle` and all should be well.
  • Loading branch information
Philip Arthur Moore committed Jun 20, 2014
1 parent 1010ca3 commit 7903f4e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ An ID isn't necessary for `get_the_subtitle`, but will work for retrieving subti

All versions of _Subtitles_ can be found on the [Releases](https://github.com/philiparthurmoore/Subtitles/releases) page.

### [v1.0.4](https://github.com/philiparthurmoore/Subtitles/releases/tag/v1.0.4) (June 20th, 2014)

- Bug Fix: Make sure that other plugins that try to mess with titles do not cause _Subtitles_ to throw PHP warnings due to the second optional `$id` parameter not being sent to the primary `the_subtitles` method used throughout sites (see [issue](https://github.com/philiparthurmoore/Subtitles/issues/16)).

### [v1.0.3](https://github.com/philiparthurmoore/Subtitles/releases/tag/v1.0.3) (June 19th, 2014)

- Bug Fix: Ensure that _Subtitles_ works in PHP 5.2.4 environments (see [issue](https://github.com/philiparthurmoore/Subtitles/issues/8)).
Expand Down
2 changes: 1 addition & 1 deletion public/class-subtitles.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public function subtitle_scripts() {
*
* @since 1.0.0
*/
public function the_subtitle( $title, $id ) {
public function the_subtitle( $title, $id = null ) {
/**
* Which globals will we need?
*
Expand Down
2 changes: 1 addition & 1 deletion subtitles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Easily add subtitles into your WordPress posts, pages, custom post types, and themes.
* Author: Philip Arthur Moore
* Author URI: https://philiparthurmoore.com/
* Version: 1.0.3
* Version: 1.0.4
* Text Domain: subtitles
* Domain Path: /languages/
* License: GNU General Public License v2 or later
Expand Down

0 comments on commit 7903f4e

Please sign in to comment.