Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Adding this PHP code to your wordpress theme will allow you to define a post thumbnail. Create a custom field called post-img and add a URL to your image.
- <div style="background-image:url('.get_the_post_thumbnail_url($idd, 'large' ).')" class="single_slider">
- <?php
- $postimageurl = get_post_meta($post->ID, 'post-img', true);
- if ($postimageurl) {
- ?>
- <a href="<?php the_permalink(); ?>" rel="bookmark"><img src="<?php echo $postimageurl; ?>" alt="<?php the_title(); ?>" width="210" height="210" /></a>
- <?php } else { ?>
- <a href="<?php the_permalink(); ?>" rel="bookmark"><img src="<?php bloginfo('template_url'); ?>/images/wpbeginner.gif" alt="<?php the_title(); ?>" width="210" height="210" /></a>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement