Closed actual-saurabh closed 8 years ago
@actual-saurabh Love the idea. Go ahead and whip up a PR for it, and I'll make sure to get it in the next release ASAP. Your use case makes total sense there. Thanks for bringing it to my attention!
Note that documentation has been added here: https://github.com/professionalthemes/Subtitles#allow-developers-to-override-the-early-bailout-if-no-subtitle-exists.
👍
Hi @philiparthurmoore,
For a project, I needed to add subtitles and prefixes to titles. Rather than reinventing the wheel, I use this plugin and it's great.
I used the
the_subtitle
filter in https://github.com/professionalthemes/Subtitles/blob/master/public/class-subtitles.php#L713 to add prefixes to my custom post type titles. It helps me that Subtitles has already taken the decisions that my code needs to take before displaying prefixes.Only problem is some of my posts have a prefix, but not a subtitle. Because of https://github.com/professionalthemes/Subtitles/blob/master/public/class-subtitles.php#L586-L588, I never reach the filter.
Right now, I have two strategies:
the_title
andsingle_post_title
on my own and try to replicate almost everything that the the_subtitle method does somehow or duplicate and plug the classSubtitles
itself. Not elegant at all.Would you be open to adding a boolean filter that allows the code to continue at https://github.com/professionalthemes/Subtitles/blob/master/public/class-subtitles.php#L586-L588? It could be set to false when subtitles are empty, but an extension like mine could force set it to true.
If you are, I can send in a PR.