Adding post thumbnails in wordpress
In this article I will tell you how to add post thumbnails in your wordpress theme, and in the other part of the tutorial I will show you how to use them.
To add the support for posting custom thumbnails firstly you need to open your functions.php file. In here you have to add the following code:
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 80, 80, true );
The first line will enable post and pages thumbnail support for the theme. This is the most important line, as without it the thumbnails wouldn't work. The second line is optional, it tells the theme what size will the thumbnail be, in this case 80pixels (width) by 80pixels (height).
Now we finished telling wordpress that we want our thumbnails to be enabled, but we didn't tell it where we want them. So to do this we need to open the page where our posts or pages are situated. This may vary from theme to theme. Most oftenly it will be directly in the index.php file. Next step is finding "the loop":
More about the loop here
Now I will show you two options. One option is to simply add the thumbnail code inside the loop. And in result when wordpress will find that the author has added his thumbnail it will display it, and when the thumbnail isn't added, it won't do anything. So here is the code, wchich you must add between the loop:
Now for the second option, if you want to display a default image when the author didn't add any thumbnail of his own, you must apply this code:
<?php if(!has_post_thumbnail()){ ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/default_thumbnail.png" alt="<?php the_title(); ?>" />
<?php }else { the_post_thumbnail('post-thumbnails'); } ?>
This then checks if the post has a custom thumbnail, if not it will display an image from:
"theme-directory"/images/default_thumbnail.png
This is it, you're finished! If you want to know how to use the custom thumbnails on your wordpress website than follow this link to my other tutorial:
Using thumbnails in wordpress
Questions and Answers
PSD to WordPress conversion is first-rate solution for creating WordPress theme from a Photoshop in order to get search engine friendly web blogging portal.
PSD to WordPress conversion is top-notch explanation for creating WordPress theme from a Photoshop in arrange to get search engine friendly blogging web portal. This type of PSD integration plays very important role in building visually appealing content managed blog portals.
7 Tips for PSD to Wordpress Conversion
Rockstar WordPress Designer VS Digging Into WordPress is a review on two well known eBooks by two groups of authors, Collis Ta'eed & Harley Alexander and Chris Coyier & Jeff Starr. They both offer breakdowns on the WordPress CMS, taking the beginner by hand and showing them some practical lessons in the hope that they will get better and be motivated to improve their Wordpress coding skills.
WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL.
Avaptech is a leading company in Chandigarh which provides Industrial training to various students of B.Tech and MCA. This is the best place for students to build their career in the field of software development.
A fresh look at some of my reasons for suspicion - and a continuing battle against the organised group of bloggers.
7 Steps Important to Make Best Strategy Blog to Development for Your Business Online
Getting into social media marketing is a smart idea for any business owner. No matter whether your business is online or offline, this still remains true. With so many businesses reaping the benefits of social marketing, it's a shame to see so many others losing out. Just looking at it from this angle highlights the value of using a blog for your business. A blog can give any business an immediate benefit when it comes to social media.
Getting into social media marketing is a smart idea for any business owner. No matter whether your business is online or offline, this still remains true. The web environment for business is focusing on social marketing so much that it becomes imperative. Just looking at it from this angle highlights the value of using a blog for your business. A blog can give any business an immediate benefit when it comes to social media.
If you want to see real results from your online marketing efforts, a blog for any business is the perfect choice. Seriously, you can build the simplest blog and do well depending on your business. When you have your blog running, you can focus on some serious marketing for it. A blog will support just about any kind of content format, so a video blog will work very well indeed. This article will look at some simple strategies for building up a blog for your business.

