How to add the featured image to my blog posts page
-
Hey Everyone,
I am looking for some help on a problem I am having.
I am trying to see if there is a way to add a featured image in each post to display as a thumbnail on the blog posts page and at the top of each individual blog post.Right now my code looks like this
<section>
<?php while(have_posts()) : the_post(); ?>
<div itemscope itemtype=”https://schema.org/BlogPosting”>
<div class=”post” id=”<?php the_ID(); ?>”><h2 itemprop=”headline”>“><?php the_title(); ?></h2>
</div>
<p class=”postmeta”> Posted on <span itemprop=”datePublished”><?php the_time( get_option( ‘date_format’ ) ) ?></span> by <span itemprop=”author”><?php the_author() ?></span></p>
<span itemprop=”articleBody”><?php the_content(); ?></span>
<p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?><?php the_tags( ‘ | Tags: ‘, ‘, ‘, ”); ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></p>
</div>
<?php endwhile; ?>
<div class=”navigation”>
<div class=”alignleft”><?php next_posts_link(‘« Previous Posts’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Next posts »’) ?></div>
</div>
</section>And I am wondering how I can add the featured image in so I can also put some schema around it for SEO purposes.
Thanks a lot!
- The topic ‘How to add the featured image to my blog posts page’ is closed to new replies.