Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/03/2011, 12:32
Avatar de mayid
mayid
Colaborador
 
Fecha de Ingreso: marzo-2009
Ubicación: BsAs
Mensajes: 4.014
Antigüedad: 15 años, 1 mes
Puntos: 101
thumbnail for excerpts obsoleto en WP 3.1?

Estuve viendo maneras de mostrar una miniatura en el loop de wp.

Modificar el loop en si mismo con the_post_thumbnail('thumbnail') no funciona ok, porque muestra solo las fotos marcadas explicitamente para ser imagenes principales, y ningun otro tipo de fotos.

El plugin thumbnail for excerpts me dio ya un par de errores. Al instalarlo, diciendo que no esta definida la variable "page" en la linea 27 (que se corresponde a $_GET['page']). Y luego, marca que get_settings esta obsoleto... desde la version 2.1 de WP!!!

Así que estoy reemplazando el get_settings por get_option pero me queda el saber de trabajar con un plugin obsoleto, y que sin embargo es el mas recomendado en toda la web para lograr esto.

Y bueno, como si esto fuera poco, me aparecen errores en algunos resumenes de posts:
Cita:
Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 200

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 203

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 206

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 209

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 210

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 214

Notice: Undefined offset: 0 in /homepages/21/d359189625/htdocs/wp-content/plugins/thumbnail-for-excerpts/thumbnailforexcerpts.php on line 215
Que se corresponden a funciones de reemplazo:

Código PHP:
Ver original
  1. preg_match_all('~<img [^\>]*>~', $content, $matches);
  2.     $first_image = $matches[0][0];
  3.     //extract alt
  4.     preg_match_all('~alt=[\'"]([^\'"]+)[\'"]~', $first_image, $matches);
  5.     $alt = $matches[1][0];
  6.     //extract title
  7.     preg_match_all('~title=[\'"]([^\'"]+)[\'"]~', $first_image, $matches);
  8.     $title = $matches[1][0];
  9.     //extract src
  10.     preg_match_all('~src=[\'"]([^\'"]+)[\'"]~', $first_image, $matches);
  11.     $src=$matches[1][0];
  12.     $srcorig=$matches[1][0];
  13.     //last try, for images with src without quotes
  14.     if(empty($src)){
  15.         preg_match_all('~src=([^\'"]+) ~', $first_image, $matches);
  16.         $src=$matches[1][0];
  17.         $srcorig=$matches[1][0];
  18.     }

NOTA: estas cosas no me pasan en servidor local, con la version 3.0 de WP. Solo en remoto con la version 3.1.