WordPress.org

Ready to get started?Download WordPress

Plugin Directory

KIA Subtitle

The KIA Subtitle plugin allows you to easily add a subtitle to your posts.

How do I display the subtitle in my theme?

The simplest way is with the the_subtitle() template tag as follows:

if( function_exists( 'the_subtitle' ) ) the_subtitle();

You can wrap the string in some markup using the $before and $after parameters.

if( function_exists( 'the_subtitle' ) ) the_subtitle( '<h2 class="subtitle">', '</h2>' );

Where do I add this code?

Unfortunately, I cannot tell you exactly what file to place the above code in because 1. I don't know where you want to display the subtitle and 2. every theme's structure is different.

However, in general, the_subtitle() is a template tag so you will want to put it in a template file. Probably, you are looking for the file that contains your post loop. For most themes it's single.php ( or page.php for pages ), but for many it could also be content.php. Assuming you want the subtitle to display directly after your main title, you'd place the above code after:

<h1 class="entry-title"><?php the_title(); ?></h1>

As an example if you wanted to display the subtitle on standard single posts, in the Twenty Twelve theme you'd edit the content.php ( or preferabbly override the template in a child theme ):

<header class="entry-header">
    <?php the_post_thumbnail(); ?>
    <?php if ( is_single() ) : ?>
    <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php if( function_exists( 'the_subtitle' ) ) the_subtitle( '<h2 class="subtitle">', '</h2>' ); ?>
    <?php else : ?>
    <h1 class="entry-title">
        <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    </h1>
    <?php endif; // is_single() ?>
    <?php if ( comments_open() ) : ?>
        <div class="comments-link">
            <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
        </div><!-- .comments-link -->
    <?php endif; // comments_open() ?>
</header><!-- .entry-header -->

How do I style the subtitle?

If you have wrapped the subtitle in an H2 tag with the class of subtitle like in the second example above, you can then style it any way you'd like.

h2.subtitle { color: pink; }

Requires: 3.8 or higher
Compatible up to: 3.8.3
Last Updated: 2014-2-21
Downloads: 6,801

Ratings

4 stars
4.9 out of 5 stars

Support

1 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1 100,1,1 100,1,1
100,1,1
100,1,1