jueves, 25 de febrero de 2010

Miniaturas en Wordpress

Hace poco pense en usar esta funcion, a ver si me animo, me da un poco de pereza por el tener que editar plantillas que apenas conozco su funcionamiento.

Mark on WordPress

New in WordPress 2.9: Post Thumbnail Images

First, in the theme’s functions.php, declare that your theme supports this feature. This will enable the UI in the WP Admin.

1add_theme_support( 'post-thumbnails' );

That will enable Post Thumbnail UI for both Post and Page content types. If you’d only like to add it to one, you can do it like this:

1add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
2add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pages

Simply remove the one you don’t want to support.

1set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, box resize mode
1set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, hard crop mode
1<?php
2if ( has_post_thumbnail() ) {
3    // the current post has a thumbnail
4} else {
5    // the current post lacks a thumbnail
6}
7?>
 blog it

No hay comentarios: