WordPress.org

Forums

Why isn't WordPress XHTML compliant? (5 posts)

  1. PoPSiCLe
    Member
    Posted 4 years ago #

    I'm just wondering. Time and time again, I've seen bad code, especially in the output of built-in functions - lately the automatic embed-function for Flash-based content, for example Youtube videos. How is it possible to manage to make this such a horrible output, when the content manager (WordPress itself) is supposed to be XHTML?

    Another one of my pet peeves is the image caption-output. It's also horrible, in that it usually doesn't work well if you put it in the middle of a paragraph (div's inside p's anyone?) - so I had to rewrite it and made my own. It uses span's instead, and can be used within or outside a p-tag without problems.

    These are minor things, perhaps, but when one strives to make a site validate, it's annoying. At the same time, WordPress decides to use Aria and other meta-tags which aren't confirmed yet. No consistency, really. Not to mention the futility of using XHTML to begin with, since it's more or less dead after W3C decided to scrap XHTML 2.

    So, what it all boils down to - is it possible for me to rewrite the horrible, horrible embed-function in my own functions.php? If so, what do I look for - the documentation of the whole thing is also abysmal, unfortunately.

  2. In both cases, WordPress is at the mercy of what TinyMCE (the third-party Visual editor) outputs until they get a chance to make their own.

    In the case of video embeds, most video services don't even provide valid embed code to begin with, but for XHTML-valid embeds, try this plugin:

    http://wordpress.org/extend/plugins/vipers-video-quicktags/

  3. PoPSiCLe
    Member
    Posted 4 years ago #

    How can it be the mercy of TinyMCE? The caption-code is a function somewhere in the wordpress-files, and you can (and I have) rewrite it in your own functions.php - just change the built-in function to begin with. The caption is a shortcode, nothing more.

    As for using plugins for the video embeds, that's not an option. I want to know where the automatic parsing resides, and try to write a new version of it - this is for a theme-build, and I don't want it to output crappy code - not to mention that the embed-code doesn't even provide a wmode="transparent" (or opaque) so as to render HTML in front of Flash-video - another omission which basically renders the whole thing useless.

    Yes, I know I could probably provide a function to add a specific shortcode around video-links, but this would still have to be explained, and I would rather that minor fixes like this was actually implemented.

  4. Validation is not the be all and end all, especially since we should all really be pushing for HTML 5 IMO ;)

    The embeds, iirc, are calling the code as provided from the sources (so YouTube, or what have you), and are at their mercy.

    If you've rewritten the caption code to make it compliant, would you consider sharing it on trac as a patch?

  5. PoPSiCLe
    Member
    Posted 4 years ago #

    I wouldn't mind, but I have no real clue as to how to do that :) Will look into it.

    Although, it involves both a bit of CSS and a rewrite of the function itself, IIRC.

    Edit:Okay, ticket submitted, with code

    Okay, if the function for embedding things automatically pulls the Youtube-code, I can see how it's not compliant - the Youtube embed-code is horrible. I guess I'll just have to forget about that bit, and chalk that up to third-party crap code.

Topic Closed

This topic has been closed to new replies.

About this Topic