Support » Plugin: WP Subtitle » get_the_subtitle() returning NULL

  • Resolved Pierre P.

    (@pjoy)


    The function get_the_subtitle() doesn’t seem to be working since it doesn’t return anything.

    the_subtitle() is working fine though…

    Temporary workaround for those encountering the same issue :

    ob_start();
    the_subtitle();
    $subtitle = ob_get_clean();
    • This topic was modified 4 years ago by Pierre P..
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ben Huson

    (@husobj)

    Hi,

    Yes, unfortunately when I inherited and took over maintenance of this plugin if already had the get_the_subtitle() function which echoed the title rather than returning it.

    As the plugin was well established, I couldn’t really change that functionality without breaking it for a lot of people.

    So the get_the_subtitle() function has a 4th parameter which you can override to return rather than echo the subtitle – see https://github.com/benhuson/wp-subtitle/wiki/get_the_subtitle

    <?php get_the_subtitle( get_teh_ID(), '', '', false ); ?>

    I know this makes no sense but it is to provide backward compatibility for existing users.

    Maybe I should introduce a get_subtitle() function, or something similar?

    Ben

    • This reply was modified 4 years ago by Ben Huson.
    Thread Starter Pierre P.

    (@pjoy)

    I get it 🙂

    For me it doesn’t need to make sense as long as it works, thanks !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_the_subtitle() returning NULL’ is closed to new replies.