Displaying Post Content on tooltip
The problem is that your template doesn’t have any quotes around the title attribute at all:
title=<?php echo get_the_content('post_content', $post->ID); ?>
So the browser’s making its best guess and using the first word. So you need to add the quotes:
title="<?php echo get_the_content('post_content', $post->ID); ?>"
Also, if you’re outputting arbitrary content into an attribute you should use the esc_attr()
function to escape the content so that any characters like "
, <
, or >
cannot break the HTML:
title="<?php echo esc_attr( get_the_content('post_content', $post->ID ) ); ?>"