adding date/time to tooltip
-
Theme TwentyTwenty shows the excerpt below the title, but I changed that to show the date instead. I wanted the time to be there, but not obvious, so I created a tooltip that shows the date and time of posting:
<div id="post-date"><span title="Published on <?php echo the_time('F j, Y'); ?> at <?php echo the_time(); ?>"><?php echo the_date(); ?></span></div>
It works great!
But when I want to add that to the entry title, the text shows in the tooltip, but the date and time print above the title.
if ( is_singular() ) { the_title( '<h3 class="entry-title">', '</h3>' ); } else { the_title( '<h3 class="entry-title"><span title="Published on ' . _e( the_time('F j, Y') ) . ' at ' . _e( the_time() ) . '">', '</span></h3>' ); }
I’m quite the amateur – it took me at least an hour to figure out how to “translate” the php from the first code into something that didn’t cause an error in the second code, but I cannot figure out how to make it write in the tooltip rather than above the title.
My point is, I’m really trying to figure this stuff out, but I also have no idea what I am doing, so when I get to this point, I’m lost.
Please help?
Thank you!
- The topic ‘adding date/time to tooltip’ is closed to new replies.