WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Microdata in Event Display Builder

[Resolved] Microdata in Event Display Builder

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Ross Hanney

    @rosshanney

    Hello,

    The plugin filters the event display builder stuff through the WordPress KSES filter, which is effectively a whitelist of allowed HTML tags and attributes. The <meta> tags and item* attribues used in microdata are not on this whitelist.

    However, you could use microformats (also described on the page you linked), as these use class attributes, which are on the whitelist.

    But if you’re dead set on using microdata, I could provide a little functionality plugin that you could install, which would add the microdata tags / attributes to the KSES whitelist.

    Hello,
    I asked questions in the past and again, thank you for the prompt response.
    I first tried microdata because they present it as the first solution so I thought the chance of compatibility was greater.

    I have been able to add the microdata on the body of a post itself and it was detected by Google so it seems it was not stripped away. Is the whitelist you mention specific to certain areas of WordPress?

    I will try the microformats. And if you have a plugin ready to add microdata support, I would be interested in having a look as well.

    Thank you again for the prompt and detailed help.

    Plugin Contributor Ross Hanney

    @rosshanney

    If you’re logged in to WordPress as an administrator or editor, you have the unfiltered_html capability, which allows you to use any HTML in posts / comments etc. Other roles don’t have this capability (by default, at least), so are subject to the whitelist.

    My plugin just applies the whitelist to the event display builder regardless of role, which, to be honest, is probably overkill, but that’s something I’ll need to look into for future development.

    The functionality plugin can be downloaded here (the code is here, if you’re interested).

    The plugin adds the itemtype, itemscope and itemprop attributes to the whitelist for the <div>, <span>, <a>, <img>, <time> and <meta> tags. It also add the adds the content attribute for <meta> and <span> tags, and the datetime attribute to the <time> tag.

    That, Sir, is first-class support !!
    Thank you for your help (AGAIN) and for teaching me a thing or two on the way.
    It is of course “resolved” for me, but just a quick question since it is the first time I use a simple “plugin” in that way with just a function and add_action. Shall it be added in the plugin directory and installed like a regular plugin or can I just paste that function and add_action to my functions.php file?
    Does it change anything in terms of performance for WordPress?

    Again, hats off to you.

    Plugin Contributor Ross Hanney

    @rosshanney

    It’s probably best to keep the code as a plugin, rather than adding it to your functions.php file (although it would work there), as it gives you the ability to turn the functionality off, if required, and means that if you decide to change themes at some point, it’ll still work.

    Any difference in performance will be pretty negligible.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Microdata in Event Display Builder’ is closed to new replies.