Ah! OK. Single post pages…
Right, if you go back and look at the WordPress Template Hierarchy, you’ll see that the possible pages you’ve got to deal with are those where either is_single() or is_attachment() is true. You’re probably not bothered about the is_attachment() line, I assume, so you need to look for these files:
- single-*.php
- single.php
- index.php
Any, or all, of those files might be outputting the HTML that goes into a single post. Unfortunately, you’re going to have to do some detective work, because there are a number of different strategies that a theme can adopt. For instance, the default twenty eleven theme has a single.php file with code like this in it:
<?php
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<nav id="nav-single">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span>
<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span>
</nav><!-- #nav-single -->
<?php get_template_part( 'content', 'single' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
Notice that this calls (or includes) another file called either content.php or content-single.php. As it happens, content-single.php exists so it is the code in there that runs.
Depending on exactly what you want, you may want to inject your code into one or other of these files. It will depend on exactly where you want your code to appear.
Turning to the twenty ten default theme, we see a different strategy. In twenty ten there is a single.php file that looks like this:
<?php
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
get_template_part( 'loop', 'single' );
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
As you can see, this calls a file called either loop-single.php or loop.php. By default, twenty ten has a loop-single.php file and it is this one that will be called (included).
Again, you examine the code to see where you want to inject your own code, and into what file.
If you need help in determining where the code should go it would greatly assist us if you posted a link to a sample page with a description of exactly where you want the new output to be.
Just a thought. If you have a custom theme, shouldn’t the person who created that theme be doing these changes?
Cheers
PAE