Support » Fixing WordPress » There is no attribute "excerpt" – Help to solve this validation error

  • Resolved lyvyoo

    (@lyvyoo)


    Hello,

    I try to solve this validation error:

    there is no attribute “excerpt”

    The line affected is located in index.php:

    <h2><a style="font-size:12px" href="<?php the_permalink(); ?>" excerpt="<?php the_excerpt(); ?>"><?php the_excerpt(); ?></a></h2>

    What is wrong in my code?

    Thank you,

Viewing 7 replies - 1 through 7 (of 7 total)
  • Chris Olbekson

    (@c3mdigital)

    Level 12 Bug Squasher & Forum Moderator

    There is no excerpt attribute. I think you have it confused with the title attribute.

    <h2>
        <a style="font-size:12px" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </h2>

    Thank you,
    Your code isn’t ok for me beacause make to disappear my post excerpt, when you are with the mouse over the photos – http://www.liviufratila.ro/

    Michael

    (@alchymyth)

    Forum Moderator

    simply remove it;

    example:

    <h2><a style="font-size:12px" href="<?php the_permalink(); ?>"><?php the_excerpt(); ?></a></h2>

    alchymyth Thank you! It worked!

    Now, in this new line that solve the topic problem, I have a secondary and last error:

    “document type does not allow element “p” here; missing one of “button”, “map”, “object”, “ins”, “del”, “noscript” start-tag” (W3C Validator)

    But I don’t see “p” in php code…

    <h2><a style="font-size:12px" href="<?php the_permalink(); ?>"><?php the_excerpt(); ?></a></h2>

    Michael

    (@alchymyth)

    Forum Moderator

    the_excerpt() automatically wraps the text into a <p> tag;

    try and use this instead:

    <h2><a style="font-size:12px" href="<?php the_permalink(); ?>"><?php echo get_the_excerpt(); ?></a></h2>

    http://codex.wordpress.org/Function_Reference/get_the_excerpt

    Thank you again! You help me a lot to validate the html.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘There is no attribute "excerpt" – Help to solve this validation error’ is closed to new replies.