Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/03/2011, 13:58
Avatar de tranzorx
tranzorx
 
Fecha de Ingreso: marzo-2008
Mensajes: 114
Antigüedad: 16 años, 1 mes
Puntos: 7
Errores de validación W3C en un Theme de WordPress

Hola a todos.
Soy estudiante principiante de programación y mis razonamientos pueden estar intrínsecamente errados.

Tengo una plantilla de WordPress "Ecommerce Theme" instalada en localhost (127.0.0.1) que me arroja un error cada vez que le añado una nueva entrada o post.
Es un problema acumulativo; cada vez que añado una entrada me da dos errores y una advertencia de validación.
Mi teoría es que el problema debe de estar en el archivo anida la generación de post index.php.

A continuación una linea de error del validador, luego el código fuente correspondiente y al final el archivo index.php.

A ver si alguien fuese tan amable de indicarme qué elemento sobra o falta en el código.
Lo más explícito posible, no tengo ni idea de lenguaje PHP.

Muchas gracias por la respuesta.
Un saludo.

P.D.:
Por cierto que los permalinks (enlaces permanentes) en modo local sólo me acepta la opción por defecto.
Para todas las demás no me reconoce el modo de codificar la URL.
En la página remota no tengo tal problema, supongo que será normal.

ERROR VALIDACIÓN EN LÍNEA 170
Cita:

# Error Line 170, Column 78: ID "post-17" already defined

…="bookmark" title="Entrada 7"><h3 id="post-17">Entrada 7</h3><img src="" alt="…

An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).

# Info Line 169, Column 26: ID "post-17" first defined here

<div id="post-17" class="thumbnail">

# Error Line 170, Column 86: document type does not allow element "h3" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

…rk" title="Entrada 7"><h3 id="post-17">Entrada 7</h3><img src="" alt="Entrada …

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

CÓDIGO FUENTE DEL ERROR EN LINEA 170
Cita:

169 <div id="post-17" class="thumbnail">


170 <a href="http://localhost/wp/?p=17" rel="bookmark" title="Entrada 7"><h3 id="post-17">Entrada 7</h3><img src="" alt="Entrada 7 " /></a>

171 <p><a href="http://localhost/wp/?category_name=sin-categoria" title="Ver todas las entradas en Sin categoría" rel="category">Sin categoría</a></p>

172 </div>

ARCHIVO INDEX.PHP (Interlineado modificado para mayor claridad)
Cita:

<!--include sidebar-->

<?php include(TEMPLATEPATH."/l_sidebar.php");?>

<div id="content">

<!--index.php-->

<?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>

<div id="post-<?php the_ID(); ?>" class="thumbnail">

<a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3><img src="<?php echo get_post_meta($post->ID, "Thumbnail", true); ?>" alt="<?php the_title(); ?> <?php _e(''); ?>" /></a>

<p><?php the_category(', ') ?></p>
</div>

<?php endwhile; // end of one post ?>

<!-- Previous/Next page navigation -->
<div class="page-nav">
<div class="nav-previous"><?php previous_posts_link('&laquo; Previous Page') ?></div>
<div class="nav-next"><?php next_posts_link('Next Page &raquo;') ?></div>
</div>

<?php else : // do not delete ?>

<h3>Page Not Found</h3>
<p>We're sorry, but the page you are looking for isn't here.</p>
<p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>

<?php endif; // do not delete ?>


<!--index.php end-->
</div>

<!--include footer-->
<?php get_footer(); ?>