Set Default Featured Image and Thumbnail for New Posts
-
Hello,
We use the same Featured Image for all of our new posts, and I am trying to edit my template code so that it automatically sets the featured image. I know the URL of the image I want to use, but could someone please help me with editing the code?
Code in Blog Page Template:
<?php $post_image_size = of_get_option('post_image_size'); ?> <?php if($post_image_size=='' || $post_image_size=='normal'){ ?> <?php if(has_post_thumbnail()) { echo '<a href="'; the_permalink(); echo '">'; echo '<div class="featured-thumbnail"><div class="img-wrap">'; the_post_thumbnail(); echo '</div></div>'; echo '</a>'; } ?> <?php } else { ?> <?php if(has_post_thumbnail()) { echo '<a href="'; the_permalink(); echo '">'; echo '<div class="featured-thumbnail large"><div class="img-wrap"><div class="f-thumb-wrap">'; the_post_thumbnail('post-thumbnail-xl'); echo '</div></div></div>'; echo '</a>'; } ?> <?php } ?>
Code in Single Post:
<?php $single_image_size = of_get_option('single_image_size'); ?> <?php if($single_image_size=='' || $single_image_size=='normal'){ ?> <?php if(has_post_thumbnail()) { echo '<div class="featured-thumbnail"><div class="img-wrap">'; the_post_thumbnail(); echo '</div></div>'; } ?> <?php } else { ?> <?php if(has_post_thumbnail()) { echo '<div class="featured-thumbnail large"><div class="img-wrap"><div class="f-thumb-wrap">'; the_post_thumbnail('post-thumbnail-xl'); echo '</div></div></div>'; } ?> <?php } ?>
Any help would be much appreciated.
- The topic ‘Set Default Featured Image and Thumbnail for New Posts’ is closed to new replies.