Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/06/2011, 11:20
Avatar de metacortex
metacortex
Viejo demente
 
Fecha de Ingreso: junio-2004
Ubicación: Caracas - Venezuela
Mensajes: 9.027
Antigüedad: 19 años, 10 meses
Puntos: 832
Respuesta: Eliminar enlace "<a href" de las miniaturas en galeria

Lamentablemente ésta es una de las zonas del sistema de archivos cuyo código se ha quedado rezagado en cuanto a las necesidades del desarrollador. Por ahora es preciso reemplazar la función. Copia esto en tu functions.php:

Código PHP:
Ver original
  1. add_shortcode('gallery', 'gallery_short');
  2.  
  3. function gallery_short($attr) {
  4.     global $post, $wp_locale;
  5.  
  6.     static $instance = 0;
  7.     $instance++;
  8.  
  9.     // Allow plugins/themes to override the default gallery template.
  10.     $output = apply_filters('post_gallery', '', $attr);
  11.     if ( $output != '' )
  12.         return $output;
  13.  
  14.     // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
  15.     if ( isset( $attr['orderby'] ) ) {
  16.         $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
  17.         if ( !$attr['orderby'] )
  18.             unset( $attr['orderby'] );
  19.     }
  20.  
  21.     extract(shortcode_atts(array(
  22.         'order'      => 'ASC',
  23.         'orderby'    => 'menu_order ID',
  24.         'id'         => $post->ID,
  25.         'itemtag'    => 'dl',
  26.         'icontag'    => 'dt',
  27.         'captiontag' => 'dd',
  28.         'columns'    => 3,
  29.         'size'       => 'thumbnail',
  30.         'include'    => '',
  31.         'exclude'    => ''
  32.     ), $attr));
  33.  
  34.     $id = intval($id);
  35.     if ( 'RAND' == $order )
  36.         $orderby = 'none';
  37.  
  38.     if ( !empty($include) ) {
  39.         $include = preg_replace( '/[^0-9,]+/', '', $include );
  40.         $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  41.  
  42.         $attachments = array();
  43.         foreach ( $_attachments as $key => $val ) {
  44.             $attachments[$val->ID] = $_attachments[$key];
  45.         }
  46.     } elseif ( !empty($exclude) ) {
  47.         $exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
  48.         $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  49.     } else {
  50.         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  51.     }
  52.  
  53.     if ( empty($attachments) )
  54.         return '';
  55.  
  56.     if ( is_feed() ) {
  57.         $output = "\n";
  58.         foreach ( $attachments as $att_id => $attachment )
  59.             $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
  60.         return $output;
  61.     }
  62.  
  63.     $itemtag = tag_escape($itemtag);
  64.     $captiontag = tag_escape($captiontag);
  65.     $columns = intval($columns);
  66.     $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
  67.     $float = is_rtl() ? 'right' : 'left';
  68.  
  69.     $selector = "gallery-{$instance}";
  70.  
  71.     $gallery_style = $gallery_div = '';
  72.     if ( apply_filters( 'use_default_gallery_style', true ) )
  73.         $gallery_style = "
  74.         <style type='text/css'>
  75.             #{$selector} {
  76.                 margin: auto;
  77.             }
  78.             #{$selector} .gallery-item {
  79.                 float: {$float};
  80.                 margin-top: 10px;
  81.                 text-align: center;
  82.                 width: {$itemwidth}%;
  83.             }
  84.             #{$selector} img {
  85.                 border: 2px solid #cfcfcf;
  86.             }
  87.             #{$selector} .gallery-caption {
  88.                 margin-left: 0;
  89.             }
  90.         </style>
  91.         <!-- see gallery_shortcode() in wp-includes/media.php -->";
  92.     $size_class = sanitize_html_class( $size );
  93.     $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
  94.     $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
  95.  
  96.     $i = 0;
  97.     foreach ( $attachments as $id => $attachment ) {
  98.  
  99.         switch ($attr['link']) {
  100.             case 'file':
  101.                 $link = wp_get_attachment_link($id, $size, false, false);
  102.             break;
  103.             case 'no':
  104.                 $link = wp_get_attachment_image($id, $size);
  105.             break;
  106.             default:
  107.                 $link = wp_get_attachment_link($id, $size, true, false);
  108.             break;
  109.         }
  110.  
  111.         $output .= "<{$itemtag} class='gallery-item'>";
  112.         $output .= "
  113.             <{$icontag} class='gallery-icon'>
  114.                 $link
  115.             </{$icontag}>";
  116.         if ( $captiontag && trim($attachment->post_excerpt) ) {
  117.             $output .= "
  118.                 <{$captiontag} class='wp-caption-text gallery-caption'>
  119.                 " . wptexturize($attachment->post_excerpt) . "
  120.                 </{$captiontag}>";
  121.         }
  122.         $output .= "</{$itemtag}>";
  123.         if ( $columns > 0 && ++$i % $columns == 0 )
  124.             $output .= '<br style="clear: both" />';
  125.     }
  126.  
  127.     $output .= "
  128.             <br style='clear: both;' />
  129.         </div>\n";
  130.  
  131.     return $output;
  132. }
Luego prueba en tu editor escribiendo:

Código HTML:
Ver original
  1. [gallery="no"]