• 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)
  • 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>
    Thread Starter lyvyoo

    (@lyvyoo)

    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 – https://www.liviufratila.ro/

    simply remove it;

    example:

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

    (@lyvyoo)

    alchymyth Thank you! It worked!

    Thread Starter lyvyoo

    (@lyvyoo)

    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>

    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>

    https://codex.www.ads-software.com/Function_Reference/get_the_excerpt

    Thread Starter lyvyoo

    (@lyvyoo)

    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.