Advertisement
WordPress

Quick Tip: How to Use the New "Post-Thumbnail" Feature in WordPress 2.9

by

Up until the release of WordPress 2.9, setting up "post-image" support for your blog was a bit more tedious a task than it really needed to be. Luckily, that's no longer an issue. I'll show you how to get setup in this four minute video quick tip.

Step 1. Edit your Functions.php Page

// Enable support for post-thumbnails

add_theme_support('post-thumbnails');

// If we want to ensure that we only call this function if
// the user is working with WP 2.9 or higher,
// let's instead make sure that the function exists first

if ( function_exists('add_theme_support') ) {
	add_theme_support('post-thumbnails');
}

Step 2. Insert the Image Tag into your Loop

Within the "if have_posts()" loop, simply place this piece of code anywhere you like. At that point, WordPress will insert an image tag onto the page accordingly. Please note that you'll have access to a "wp-post-image" class that you may then work with to format/style the image.

<?php the_post_thumbnail(); ?>
Related Posts
  • Code
    Theme Development
    Getting The Most of Post Formats: Using Post Formats In The LoopPostformats
    Learn how to effectively control the main WordPress loop to get the most of post formats.Read More…
  • Code
    Tips
    New wp-config Tweaks You Probably Don't Know8 new wp config tweaks you probably didnt know about 400
    The wp-config.php file: One of the most loved WordPress feature for some, one of the worst nightmares for others. There are countless tips and tricks in a plethora of articles, and you can't get enough of them; however, this article is aiming to be different. In this article, we're going to get familiar with eight new wp-config tricks that are less known than functionality such as turning off post revisions, increasing the memory limit, or other similar features.Read More…
  • Code
    Theme Development
    Creating a WordPress Theme From Static HTML: Releasing Your ThemeCreating wordpress theme from html 400
    If you've been following this series you now have a working WordPress theme. Your theme has a number of template files, including a page template and an archive template, and also has featured image support.Read More…
  • Code
    Plugins
    The Beginner’s Guide to WordPress SEO by Yoast: On Page SEOThe beginners guide to wordpress seo by yoast 400
    In the last tutorial of The Beginner's Guide to WordPress SEO by Yoast we did the final tweaking, after that comes the part of how to use the On Page SEO meta box when writing a post or a page in WordPress. Today we will explore this panel/meta box and will discuss the some generic factors which help in ranking your content well. Let's start with a deeper look towards elements of this post. Read More…
  • Code
    Theme Development
    Creating a WordPress Theme from Static HTML: Adding Featured ImagesCreating wordpress theme from html 400
    You've now worked through a number of steps to create a WordPress theme from static HTML files. Specifically, we've looked covered the following: preparing your markup for WordPress converting your HTML to PHP and splitting your file into template files editing the stylesheet and uploading your theme to WordPress adding a loop to your index file adding meta tags, the wp_head hook and the site title and description to your header file adding a navigation menu adding widget areas to the header and sidebar adding widget areas, a colophon and the wp_footer hook to the footer file creating template files for static pages creating an archive template file. Your theme now has a template file for displaying archive pages, but at the moment it's not displaying images properly. In this tutorial, you'll learn how to add featured image support to your theme and how to display and style them in your archive template.Read More…
  • Code
    Tips
    The Beginner's Guide to Setting Static Front Pages in WordPressStaticfrontpage
    Typically, in a WordPress website, the home page shows the blogger's latest posts, but what if you wanted the homepage of your website to display the same page every time? For those of you who are just getting started with WordPress, then it's worth noting this is not only possible, but it's really easy.In this article, we'll talk about how to implement a static front page in WordPress as well as where it would and wouldn't be appropriate.Read More…