Support » Plugin: KIA Subtitle » where to add the code

  • Resolved mozzie


    Hi !

    Could you please tell me where exactly to add the code
    <if(function_exists(‘the_subtitle’)) the_subtitle();>

    I am not a developer and know almost nothing about programming in html. please explain very simply which file to put it in and which location in the code, eg. top , middle, bottom etc


Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author helgatheviking


    I apologize for not seeing this sooner. However, I couldn’t give you the answer you seek anyway. Your theme has lots of template files, and every theme is different so I can’t possibly tell everyone exactly where to put the code. I just can’t offer that kind of personalized support.

    Can’t you at least explain where it normally goes?
    The instructions don’t say where to put it. It just says “add this code to your theme”.

    I’m pretty good at editing theme files and even I have no idea what your instructions are talking about.

    Plugin Author helgatheviking


    The instructions can’t tell you where to add the code, because 1. I don’t know where you want to display the subtitle and 2. every theme’s structure is different. Generally, you’ll add it to a template file and inside the loop…. probably somewhere near where the_title() is displaying. But some theme frameworks encourage child theming via hooks from functions.php so even that isn’t a hard and fast rule.

    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:

    <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>
    	<?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 -->

    So it’s pretty simple then:

    It’s a sub title plug in, so most people want it under the title.

    For post titles, most themes it’s single.php and you’d place it after:
    <h1 class="entry-title"><?php the_title(); ?></h1>

    Themes vary. Basically you are looking for the file that contains your post loop.

    If you want it under your page titles, then find the page that contains your page loop. In many themes it’s page.php. “
    But it could be anything. Where ever your page loop is.

    Seems like you are over complicating it in your avoidance not to give some kind of answer.

    We all understand that not every theme names their files the same, but for people who are trying to learn and DIY, sometimes a step in the right direction is enough for them to go “Oh yeah. I know what file that’s in.”. Some kind of answer is better than “I can’t tell you where to put it, it depends on where you want it to show”

    A simple “under <h1 class="entry-title"><?php the_title(); ?></h1>” would even be helpful. It would have saved me the hour of trying to make it work in the functions.php file.

    By the way, I did all of that and it still didn’t display.

    Plugin Author helgatheviking


    I’m not trying to intentionally over-complicate things, I just figured that as soon as I say add this to single.php people will post and say that isn’t working… or the_title() isn’t in single.php, etc and I don’t want to get involved in supporting individual themes. But if you don’t mind I will borrow some of your post to update my FAQ in the next release and see if that helps.

    Oh, I know the feeling and do understand. I also appreciate the fact that you are supporting a free plug in.

    Of course feel free to snag any part of that.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘where to add the code’ is closed to new replies.