How To Use Custom Fields in WordPress To Display Thumbnails

As the world of Blogging growing day by day with growing population of new blogs, its most important to choose the theme that makes your blog comfortable. But there are many themes in WordPress which have a great look but lacks the thumbnail for each posts in home pages to enhance their blog design. The tutorial will show you to generate thumbnails for each posts and these images can be shown on the front page, archives, search pages, etc – but appear outside of the content, giving you full control of their placement and style.

What Are Custom Fields?

If you never heard about the Custom Fields, then you should check something about Custom Fields inorder of using them. You can check what wordpress tells about Custom Fields.All Custom Field allows you to add extra pieces of data to individual WordPress posts that otherwise aren’t there by default.  In other words, along with things like the Post Title, Entry, and Categories, you could add Thumbnails, Lead Images, Surce Links etc. But in this tutorials, we are going to use Custom Fields to add thumbnails in posts in different pages.  They allow you to add as many additional fields as you like, all of which can be used anyway you want to use them.

Creating Thumbnails For Posts

By creating thumbnails manually and integrate this function in your theme, it is easy way to display thumbnails to make your blog posts attractive and personalized.Its very easy to place thumbnails using Custom Fields.Now, just open your WordPress Theme directory and find a file named functions.php or if it does not present in your theme directory, then create one file with actual name functions.php .Check the code below, this code will help to locate the thumbs.

<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>

The code between these lines is the output for each individual entry shown on the front page of your Blog.  So, let’s say you limit your blog to 10 posts per page, this is the code the repeats 10 times to display those 10 posts.

<img src="<?php echo get_post_meta($post->ID, "Thumbnail", true);?>" />

This outputs an image, using the Value of the Key, Thumbnail, which we’ve inserted into our post.In spite of using keyword, you can use your desired keyword.It can be inserted anywhere within the while loop, allowing you to float it to the left or right of the header and entry, display it above an entry, below, whatever you want. The overall code will look like this :

<?php if($Thumbnail !== '')
{ ?>
<!-- Insert Code For Advanced Image Styling -->
<img src="<?php echo $Thumbnail;?>" />
<?php } ?>

The main purpose of this code is to check to see if the Thumbnail variable is empty or not. If it isn’t empty, the code will output the thumbnail image. After you’re finished customizing your code, save, and test to make sure thumbnails are being displayed properly.

Keywords:

show_thumb wordpress, thumbnails comfy, add featured image in comfy theme, pagelines custom fields, pagelines wordpress thumbnails on main page, thumbnails not showing in comfy, wordpress 4 random images custom field, wordpress comfy how to add photos, wordpress custom fields thumbnail, wordpress custom fields to displau a thumbnail, wordpress get thumbnail from custom field, how to use custom fields, how to use custom field in wordpress, how to use custom field, comfy featured custom field, comfy theme image custom field, comfy thumbnails, comfy wordpress featured image, custom fields to display thumbnails, custom fields to display thumbs on their blog homepage, display thumbnail wordpress archive page, feature thumbnails comfy, how to install custom fields wordpress, how to show thumbnail in pageline frontpage, wordpress thumbnail images not showing in comfy
About SmashinGeek

SmashinGeek is a Web Designer and loves to Write Articles. If you like this post, you can follow SmashinGeeks on Twitter. You can also Subscribe to SmashinGeeks via RSS or E-Mail to receive updates.

  • http://www.tricksdaddy.com/ Simran

    Nice and well explained article. I’ll try to implement this feature in my theme :)
    .-= Simran´s last blog ..4 Productivity Tips on Time Management =-.

  • http://techchunks.com TechChunks

    My current theme came with thumbnail support. Anyway great tips! :)
    .-= TechChunks´s last blog ..Ad Poisoning: Google, Yahoo and Fox Spreading Malware =-.

  • http://flexithemes.com FlexiThemes

    What about:
    1. Using WP 2.9 and above
    2. Adding one line of code to your current using theme’s functions.php -
    3. Adding one line of code to your current using theme’s index.php, archive.php and single.php – “alignleft post_thumbnail”)); } ?>
    4. Setting thumbnails when adding/editing post from the built in feature in WordPress 2.9 an above
    .-= FlexiThemes´s last blog ..Modern Style =-.

  • http://www.ingbase.com Mayur

    Thanks for this, i was searching for how to use custom fields to add thumbnails in wordpress. My theme already has the thumbnail feature so i think i don’t need to do the coding thing, but i don’t know what to enter in custom fields box for thumbnails to show up.
    .-= Mayur´s last blog ..Finding the right website designer =-.

  • anonymou

    is there a way to make thumbnails that are not hosted on your domain to show?
    for example, rather than having the image on /wp-content/uploads/, have a link to a flickr image?

  • Pamala Lahtinen

    Wonderful Tutorial

  • http://losangelesdailynews.net/forum/memberlist.php?mode=viewprofile&u=92115 Emilio Awbrey

    Fantastic article

  • http://www.mkj.me/index.php/member/2970 Ta Gerathy

    Fantastic piece of writing together with convenient that will understand story. How do That i set about gaining agreement that will put up part within the article in doing my coming bulletin? Offering good credit ranking to your any source together with weblink into the web page will not manifest as a challenge.

Loading...
Join Our Mailing List & Get Latest Updates !!!