• Resolved Ahni

    (@ahni)


    Hey there. I just started using this plugin to add a subtitle to specific posts. I’ve included it like this:

    <h4><?php the_secondary_title(); ?></h4>

    It words perfectly, except that, every post that doesn’t have a secondary title ends up with an empty h4 tag, eg

    <h4></h4>

    Is it possible to get rid of that superfluous html with some kind of conditional statement? thx!

    https://www.ads-software.com/plugins/secondary-title/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author thaikolja

    (@thaikolja)

    I assume you’ve deactivated “Insert automaticall”, right? If yes, you can use either

    <?php
    	if(has_secondary_title()) {
    		echo "<h4>" . get_secondary_title() . "</h4>";
    	}
    ?>

    or – even easier –

    <?php
    	// To get the current post ID, just use "0".
    	the_secondary_title(0, "<h4>", "</h4>");
    ?>

    Let me know if that worked out for you.

    Plugin Author thaikolja

    (@thaikolja)

    I’ll mark this thread as solved. If that didn’t work out, please let me know.

    Thread Starter Ahni

    (@ahni)

    Sorry for the delayed response, thaikolja. The second option still sends out empty tags; but the first one works perfectly! Thanks!

    Plugin Author thaikolja

    (@thaikolja)

    Thanks, I just fixed it, it’ll be included in the next version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘adding conditional html to manual title’ is closed to new replies.