WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to show some detail information on specific (for e.g. category=3) posts.

Therefore I use the following coding:

function postinfo_head() {

    global $post;
    $script = <<< EOF
<script type='text/javascript'>
        $('.open-post-info').click(function() {
            var id = $(this).attr('id');

            $('.post-info-' + id).slideToggle("medium", function() {

            return false;
    echo $script;
add_action('wp_head', 'postinfo_head');

function postinfo() {
    global $post;
    echo '<p class="open-post-info" id="'. $post->post_name .'">Details</p>';
    echo '<div class="post-info post-info-'. $post->post_name .'">';
    echo '<ul>';
    ... some detail fields
    echo '</ul>';
    echo '</div>';

Unfortunately the output is shown somewhere else (on top-left of the site - over the header img). How is it possible to show this coding below the header of a post?

I would reluctantly edit the template, if there is an other option of getting this to work.

BR, mybecks

share|improve this question
up vote 1 down vote accepted

You shouldn't inject postinfo() in the <head> section (that's what happens when you use the wp_head hook).

If you do not want to edit templates, I'd suggest you use the wp_footer hook instead, and append the postinfo to your header div with jQuery, e.g.:


share|improve this answer
thanks, that worked. – mybecks Jan 15 '13 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.