I thought I had this right after reading many SO articles, but I keep getting errors. Basically, in my content.php page template, I wanted to display a different article tag based on whether you were on the archive or single post page. So I've been doing something like this:
<?php if ( is_archive() ) {
echo '<article id="post-' . the_ID() . '">';
} else {
echo '<article id="post-' . the_ID() . ' . "post_class() . '">';
}
?>
But what happens here instead of it spits out the ID on the page so the resulting HTML looks like this:
1234<article id="post-">Content Goes Here</article>
when it should be....
<article id="post-1234">Content Goes Here</article>
so why isn't this showing up right?