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'>
jQuery(document).ready(function($){
$('.post-info').hide();
$('.open-post-info').click(function() {
var id = $(this).attr('id');
$('.post-info-' + id).slideToggle("medium", function() {
$(this).prev().toggleClass("toggled");
});
return false;
});
});
</script>
EOF;
echo $script;
postinfo();
}
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